News for hackers. Stuff that matters.
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'.

Grrr.

Re:Winners of the 7th Underhanded C Contest by nitrogen on Saturday June 06, 2015 @02:57PM (#9671801)
I'd call that a win. Even the judge was fooled.
Re:Winners of the 7th Underhanded C Contest by kayamon on Saturday June 06, 2015 @09:25PM (#9673042)
I'll post up my complete entry in case anyone's interested to look through it:

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.

Re:Winners of the 7th Underhanded C Contest by rcthompson on Saturday June 06, 2015 @11:38PM (#9673311)
Do the judges get to read your explanation before deciding the results, or do they just have to decide based on the code?
Re:Winners of the 7th Underhanded C Contest by kayamon on Saturday June 06, 2015 @11:45PM (#9673324)
I sent an explanation with it, no idea if anyone read it or not.
Re:Winners of the 7th Underhanded C Contest by umanwizard on Sunday June 07, 2015 @12:59AM (#9673444)
Edited to remove spoiler.
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 dbbolton on Saturday June 06, 2015 @12:02PM (#9671225)
>The PiuPiu oversharing site allows users to create PiuPiu accounts and post 140-character messages.

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

Re:Winners of the 7th Underhanded C Contest by andrepd on Saturday June 06, 2015 @12:46PM (#9671387)
Yes, and "piu" is the Portuguese onomatopoeia for "tweet".
Re:Winners of the 7th Underhanded C Contest by lamuerteflaca on Saturday June 06, 2015 @02:28PM (#9671714)
And in Spanish it is "pio" for tweet. Very close to the portuguese one.
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 djfm on Saturday June 06, 2015 @04:39PM (#9672177)
And in French "piou piou" can be used colloquially to mean "bird"... Many languages seem to agree on this.
Re:Winners of the 7th Underhanded C Contest by balazsdavid987 on Sunday June 07, 2015 @02:19AM (#9673614)
In Hungarian, "pee-pee-pee-pee" is used to at farms to call chicken. :) And sometimes, young woman are called "pee-pee"-s, in a playful way.
Re:Winners of the 7th Underhanded C Contest by emiliobumachar on Saturday June 06, 2015 @11:57AM (#9671209)
They did it backwards this year. A run-of-the-mill evil program that unexpectedly does something heroic.
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 pavel_lishin on Saturday June 06, 2015 @02:20PM (#9671691)
Sure, but it's explicitly defined as the Evil part.
Re:Winners of the 7th Underhanded C Contest by M2Ys4U on Saturday June 06, 2015 @05:07PM (#9672272)
From the view of the 'Security' Services it's evil. For everybody else it isn't.
Re:Winners of the 7th Underhanded C Contest by sillysaurus3 on Saturday June 06, 2015 @11:41AM (#9671133)
Is it possible to view all the entries with no explanation? I want to try to spot the problems.
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 masklinn on Saturday June 06, 2015 @11:49AM (#9671159)
They don't seem available anywhere, maybe try to contact [email protected] and ask if they could release the entries?
Re:Winners of the 7th Underhanded C Contest by m3talridl3y on Saturday June 06, 2015 @05:25PM (#9672330)
I'm glad to see that there are more women's names this year - including the winner. A sign of better representation in tech in the future?
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 sylvinus on Saturday June 06, 2015 @02:49PM (#9671771)
Incredible mix of evil and genius, congrats to the winners. I'm still astounded at how many obscure ways there are in C to fool a code reviewer.

Definitely makes me feel less safe considering the amount of C code there is in tools we depend on.

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 masklinn on Saturday June 06, 2015 @12:01PM (#9671220)
> and the macro used _all_ look like functions

AUDIT properly looks like a macro, which makes it even more likely a reviewer wouldn't notice __isleap is one as well.

Re:Winners of the 7th Underhanded C Contest by guelo on Saturday June 06, 2015 @02:02PM (#9671636)
I'm not a C programmer so I'm wondering, don't the common C editors highlight macros and functions differently?
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).

Good idea, though. I'd like it.

Re:Winners of the 7th Underhanded C Contest by nitrogen on Saturday June 06, 2015 @03:01PM (#9671825)
Some slightly less common IDE-based ones can, like Eclipse, and probably Kdevelop, QtCreator, and MSVC.

There are likely to be add-ons for Vim and Emacs that actually parse the source instead of just pattern matching for syntax highlighting.

Re:Winners of the 7th Underhanded C Contest by GFK_of_xmaspast on Saturday June 06, 2015 @10:07PM (#9673128)
With emacs, this actually an ideological choice.
Re:Winners of the 7th Underhanded C Contest by WalterGR on Sunday June 07, 2015 @05:50AM (#9674005)
How so?
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 WalterGR on Sunday June 07, 2015 @03:42PM (#9676087)
Interesting.

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. :)

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 egillie on Saturday June 06, 2015 @09:02PM (#9672980)
How is this different from the Obfuscated C contest? http://www.ioccc.org/
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.

https://en.wikipedia.org/wiki/Obfuscation_%28software%29

Re:Winners of the 7th Underhanded C Contest by ctdonath on Sunday June 07, 2015 @08:10AM (#9674327)
Speaking of which, anyone knows why the IOCCC results are stalled? Winners were announced but winning source code not yet released.
Re:Winners of the 7th Underhanded C Contest by roscopcoltrane on Saturday June 06, 2015 @10:59PM (#9673225)
Why is it underhanded to let a user know that his government is censoring/surveiling his posts? This should be the freedom-c contest.
Re:Winners of the 7th Underhanded C Contest by rcthompson on Saturday June 06, 2015 @11:43PM (#9673318)
It's underhanded in that the function should look like it's doing one thing but also do another hidden task as well.
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...
Re:Winners of the 7th Underhanded C Contest by shiggerino on Sunday June 07, 2015 @03:25AM (#9673746)
Why someone would use this language for a real project is beyond me.
Re:Winners of the 7th Underhanded C Contest by S4M on Sunday June 07, 2015 @08:22PM (#9676837)
A real project like writing a Kernel or implementing a programming language?
Re:Winners of the 7th Underhanded C Contest by shiggerino on Monday June 08, 2015 @02:17AM (#9677469)
Yes, real projects like that. Or projects like OpenSSL.