Linux local root exploit for CVE-2014-0038
github.com
github.com
If it's non-universal, why is it? E.g. if it only affects Ubuntu, then what is it about Ubuntu that allows this to work?
EDIT: This seems to be the answer: https://news.ycombinator.com/item?id=7154922 ... Any distro using the x32 ABI is vulnerable, and Ubuntu just recently enabled the x32 ABI.
Edit: turns out that 13.10 is released with the CONFIG_X86_X32 option enabled, just the usual negligent excessive differentiation that Canonical loves to impose on its customers(see Mir and moving forward with Upstart for recent examples).
Essentially, if this option is enabled, someone can use the linked code to exploit an x32 syscall and escalate privileges.
Ubuntu specifically is a target because they recently enabled this option; I'm not aware of any other distros that have done so.
#define PAYLOADSIZE 0x2000
code += PAYLOADSIZE - 1024;
memcpy((void*)code, &kernel_payload, 1024);
Does anybody know if it's possible to find out the size of a function during run time? Could you like say, put a return at the end of the function then do a for-loop with memcpy() for each byte until you run into the OPCODE for RET? I guess I could do a test. #include <stdio.h>
void rightmeow()
{
int q;
for(q = 0; q < 10 ; q++)
printf("It's new!\n");
return;
}
int main(int argc, char** argv)
{
int i;
unsigned char bytecode;
for(i = 0; i < 9999 ; i++)
{
bytecode = (unsigned char)(**(rightmeow+i));//--- does this really work?
if (bytecode == 0xC2 || bytecode == 0xC3)
break;
}
if( i == 9999)
printf("No good.\n");
else
printf("Okay! %x found @ %d\n",bytecode,i);
return 0;
} *(((unsigned char *)rightmeow)+i)
but just change the "q < 10" line to "q < 195" and you should see the output change, since that immediate constant is going to be present at least once before the final ret. For me, changing that changes the output from c3 being found at 47 to it being found at 25.Then again, it could be something else and not the actual return you found.
A function may have the RET in the middle of it. Or use a jmp instead of ret (tail optimization), etc.
Which is only used on the(already vastly irresponsibly-constructed) Ubuntu 13.10.
* It's new and unanalyzed for security flaws.
* It's useless without the right userland tools, which don't exist.
Ubuntu switched it on either because they have no clues, or because they wanted a checkbox to say "look, we have features no-one else does!!!!".
-Someone who just spent half of a perfectly good day wrestling with their buggy installer
Note, that Kees who raised it to linux-distro’s is a member of the Ubuntu Technical Board, Ubuntu provided a fixed kernel as part of the embargoed security window of a mere 2 days(!) and Kamal Mostafa (Canonical) provided a rebased patch back to upstream Linux 3.8.
Ubuntu was even praised on the disclosure thread [0], for this super-fast turnaround. This only cements my confidence in the Ubuntu product.. and has helped sow the seeds for an exciting Ubuntu 14.04 LTS release.
Seems the whole process worked as a well-oiled machine, making the whole Linux ecosystem safer. Note, these types of issues only tend to get discovered when they are enabled in the wild.
Doesn't work, but DID crash the kernel, so it's vulnerable.
the program did not get the root privilege. Kernel did not crash either. Strange.
Just patched it to 3.8 kernel and it works.