Live data from Hacker News

Best of show – abuse of libc

ioccc.org

81–84 of 84 posts

Re: Best of show – abuse of libc

#81

Earlier quoted context omitted.

I'm pretty sure the compilers from Microsoft and Borland supported %n earlier than that. The earliest one I have easy access to that supports it is Microsoft C 4.0 from 1986.

Does anyone know why it was introduced in the first place? I mean.....the return value of printf gives you the exact same information, no? Why give printf the ability to write anything in the first place?

Ah, I found out why - %n prints out the number of characters printed up to the point where the %n is. Printf returns the total number of characters printed.

Re: Best of show – abuse of libc

#83

Earlier quoted context omitted.

In the late 90s, looking for "printf(string)" [0] in the code was a great way to discover remote code execution 0days ;-) [0] should be "printf("%s", string)".

Very much so, it took a long time for this to become obvious as a security problem. My memory wuftpd was the first big program to suffer from this class of attacks.

It reminds me of a talk by infosec researcher "The Grugq" about opsec techniques used by blackhat hackers. Its subtitle was because jail is only for wuftpd, I couldn't stop laughing at it.

Re: Best of show – abuse of libc

#84

Earlier quoted context omitted.

dyld on Darwin has an API to ask if any pointer is to a read-only section of a binary. It’s useful because you can e.g. skip strcpys and other allocations.

Hmm, can you tell me more? I can't think of any situation where skipping on a strcpy is legal, since you provide the second buffer and so the copy must occur. And I know that there is heavy uniquing going on for things like selectors and CFStrings at compile time, but where is the dyld API being used at runtime?

Oh, I meant strdup. Look for stdupIfMutable() calls in libobjc.
Post reply on HN