Re:Winners of the 7th Underhanded C Contest
by kayamon on Saturday June 06, 2015 @02:06PM
(#9671649)
I'm kinda annoyed that the judge completely misread my entry. I had it so that data was leaked out of a function that could not possibly leak data, via a malloc side-channel attack (ala HeartBleed).
Instead it got judged as being a 'simple buffer overflow'.
Someone below asked what makes this different from the Obfuscated C contest. In this contest, the idea is to make code that looks very clean and innocent. Entries that hide their behavior in weird ugly macros or just general C complexity are not really in the spirit of the contest. I tried to make my entry very clean so that there is obviously no malicious code anywhere in it.
Re:Winners of the 7th Underhanded C Contest
by jimrandomh on Saturday June 06, 2015 @12:03PM
(#9671232)
SPOILERS. If you want to see if you can spot the tricks, do not look at this page; it only contains solutions, it doesn't contain the programs themselves!
Re:Winners of the 7th Underhanded C Contest
by joeyoung on Saturday June 06, 2015 @03:18PM
(#9671884)
Interesting. I think "pio" is the onomatopoeia for tweet in Japanese too. It's the noise cash registers at Tokyo's Inageya supermarkets make when you use their points card.
Re:Winners of the 7th Underhanded C Contest
by masklinn on Saturday June 06, 2015 @01:27PM
(#9671512)
Is that really backwards? The contest is "underhanded", not evil. Underhandedness can be used for good or evil, and it is good that this year's contest reminds entrant of that.
Re:Winners of the 7th Underhanded C Contest
by jimrandomh on Saturday June 06, 2015 @11:57AM
(#9671208)
Yeah, that really spoiled the fun for me. I wanted to read through and see if I could spot the tricks myself, but it keeps giving the answers before even showing the code that the trick is in!
Re:Winners of the 7th Underhanded C Contest
by nickpsecurity on Sunday June 07, 2015 @02:08AM
(#9673590)
Or just more interested in our field of digital sorcery. Either way, I agree it's good to see more women in these things. Having different types of people makes things more interesting. And often more surprising. :)
Re:Winners of the 7th Underhanded C Contest
by chii on Saturday June 06, 2015 @11:48AM
(#9671156)
haha, the winning entry is pure genius! It was so difficult to follow, and the code that produces the bug is only viewable if you examined the macro expanded source code - and the macro used _all_ look like functions, so a casual code reviewer probably won't recall them being macros in the first place.
Re:Winners of the 7th Underhanded C Contest
by mrpopo on Saturday June 06, 2015 @03:05PM
(#9671842)
Yes, all decent C/C++ IDEs (Eclipse, Visual Studio, CodeBlocks) use different syntax highlighting for macros and functions. The problem with nested macros like this is a common bad programming practice, highlighted here in the C/C++ FAQ : https://isocpp.org/wiki/faq/inline-functions#inline-vs-macro...
Re:Winners of the 7th Underhanded C Contest
by Someone on Saturday June 06, 2015 @03:08PM
(#9671856)
To do that you need to do quite a bit of what the compiler does. For example, you need to know the include search paths, which can get modified by compiler flags, and you need to know what flags got set on the command line, for example to discriminate debug from release builds or to specify C99 compliance.
So, you basically need an IDE to do robust C syntax coloring.
Re:Winners of the 7th Underhanded C Contest
by nothrabannosir on Saturday June 06, 2015 @02:37PM
(#9671740)
I have personally never come across this. Moreover, "common" C editors are vanilla vim and emacs, which don't actually know what's a macro and what's a function without customization (ctags &c).
Re:Winners of the 7th Underhanded C Contest
by GFK_of_xmaspast on Sunday June 07, 2015 @02:18PM
(#9675741)
For that kind of code analysis one wants more detailed information about the source file, like an AST, but Stallman has forbidden that level of detail to be exportable from gcc, and more recently squashed efforts at deeper emacs/clang integrations, both on ideological grounds.
Re:Winners of the 7th Underhanded C Contest
by rikrassen on Saturday June 06, 2015 @08:33PM
(#9672927)
I'd also imagine that since the contest is framed as getting around code reviews the code would be inspected using some other source code display tool. These tools certainly wouldn't do any kind of context-sensitive reasoning.
Re:Winners of the 7th Underhanded C Contest
by euid on Saturday June 06, 2015 @09:09PM
(#9672993)
In this contest, you are to intentionally insert a difficult-to-detect bug into otherwise legible code. In the obfuscated C contest, you are writing obfuscated code.
Re:Winners of the 7th Underhanded C Contest
by 9872 on Sunday June 07, 2015 @05:35AM
(#9673978)
Why is it underhanded to let out people whose government has locked them in cages? Sounds like freedom to me. Now where's the nearest maximum security prison...
Instead it got judged as being a 'simple buffer overflow'.
Grrr.
http://www.codersnotes.com/files/piupiu.zip
See surveil.txt for notes first.
Someone below asked what makes this different from the Obfuscated C contest. In this contest, the idea is to make code that looks very clean and innocent. Entries that hide their behavior in weird ugly macros or just general C complexity are not really in the spirit of the contest. I tried to make my entry very clean so that there is obviously no malicious code anywhere in it.
Hah- "Piu-Piu" is the Brazilian-Portuguese name for the Looney Tunes character Tweety:
https://pt.wikipedia.org/wiki/Piu-piu
https://en.wikipedia.org/wiki/Tweety
Definitely makes me feel less safe considering the amount of C code there is in tools we depend on.
AUDIT properly looks like a macro, which makes it even more likely a reviewer wouldn't notice __isleap is one as well.
So, you basically need an IDE to do robust C syntax coloring.
Good idea, though. I'd like it.
There are likely to be add-ons for Vim and Emacs that actually parse the source instead of just pattern matching for syntax highlighting.
How can deeper integration between any language and tools then be compatible with rms's and/or GNU's and/or the FSF's ideology?
(Maybe the answer is, "Use Lisp since the syntax is the AST." I'm okay with that. :)
https://en.wikipedia.org/wiki/Obfuscation_%28software%29