2008 Underhanded C Contest Officially Open 160
Xcott Craver writes "The 2008 Underhanded C Contest has just opened. Every year, contestants are asked to write a simple, innocent, readable C program that appears to perform an innocent task — but implements some non-obvious evil behavior. This year's challenge: redact blocks from an image, but do it so that the excised pixels can somehow be retrieved. We also have listed the winners of last year's contest, which was to write a simple encryption utility that mysteriously and undetectably fails between 1 percent and 0.1 percent of the time. The winning entry is truly impressive."
We discussed the first of these contests in 2005.
I submit (Score:5, Funny)
Re:I submit (Score:5, Funny)
Um, hello? Simple? Readable? Seemingly innocent? Does any current version of Windows manage to fulfil even one of these criteria?
Re:I submit (Score:5, Funny)
Um, hello? Simple? Readable? Seemingly innocent? Does any current version of Windows manage to fulfil even one of these criteria?
Re:I submit (Score:4, Funny)
Re:I submit (Score:5, Insightful)
Re: (Score:2)
Shame - I would actually like to have a look at the current MP scheduler.
Re: (Score:2)
http://www.microsoft.com/resources/sharedsource/licensing/researchkernel.mspx [microsoft.com]
It's not exactly SourceForge but it'll get you the source.
I don't know if that'll have the current MP scheduler though.
Re: (Score:2)
You have to be from a registered academic institution which has signed up for the program, and the downloader has to be a teaching representative of the institution.
To quote the page:
"Use of the Windows Research Kernel requires academic affiliation with an accredited institution of higher education and direct involvement in teaching and/or research, such as being academic faculty members, system or lab administ
Re: (Score:3, Interesting)
Re:I submit (Score:5, Funny)
--The IP Police
Re: (Score:2, Funny)
--The IP Police
127.0.0.1
Re:I submit (Score:5, Informative)
http://www.kuro5hin.org/story/2004/2/15/71552/7795 [kuro5hin.org]
There is some variety in the commenting style. Sometimes blocks use a
Re: (Score:2, Interesting)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re:Poor low-level MS devs (Score:3, Interesting)
This cheers me up just a little.
We rage against the management decisions of MS, but I'm positive the ranks are filled with decent guys just trying to pay for dinner & rent.
"We haven't a clue what this does but it's vital..."
Seems to me that if the source were opened, within 5 years we'd at least know what all the hacks did, even if they were still necessary.
invisible ink (Score:4, Funny)
Re:invisible ink (Score:5, Interesting)
Encryption utility that fails... (Score:5, Funny)
(sorry, couldn't resist, I know they've suffered enough already)
Even better (Score:5, Interesting)
Turns out it just copied the contents to a temporary file and "uncompressing" got them back from there, while the "archive" was just random junk. Better yet, the temporary file was just a circular buffer, so when it filled, old data got discarded.
WIC (Score:5, Funny)
Hide the evil code? (Score:5, Interesting)
Maybe stick in stuff in the image loader, image temporary copy code, and keep the blackener to the obvious implementation, then stick stuff in the saver.
I thought some crazy stuff involving function pointers as the function to call to return a black pixel might be promising. Maybe use some out of bounds array math to change one function pointer to point to some other code.
Re:Hide the evil code? (Score:5, Insightful)
Re: (Score:3, Interesting)
Re:Hide the evil code? (Score:4, Funny)
Re:Hide the evil code? (Score:5, Interesting)
In 2006, http://www.brainhz.com/underhanded/results2006.html [brainhz.com] you get people exploiting the fact that 64 bit and 32 bit OS are different, or that some OSes are big endian and some little, and so on. There are all sorts of nasty tricks that are possible.
One possible option for this contest is to hide information in the lower bounds of each pixel (stenography like), there isn't much space, but you could recover some information from the original. And a one bit difference in black isn't easy to spot...
Of course, I can't code C, so I don't know what I'm talking about.
Re:Hide the evil code? (Score:5, Insightful)
Re: (Score:2, Interesting)
I can't just think how one could do it, and still pass inspection, however, I'm not trying to enter the contest, so
Re: (Score:2)
Re: (Score:2, Funny)
Re: (Score:3, Interesting)
There are millions of ways to write nasty code in C, since C is just a thin veneer on top of assembler.
Re: (Score:2)
I was able to successfully keep the color data by converting each RGB triplet to 16 bits of color, then distributing them across the image in the bottom two bits of each pixel. It's pretty much impossible to tell visually that there's any extra pixel data stored in the redacted image, and the restored image looks almost identical to the original.
When
Re:Hide the evil code? (Score:4, Funny)
Re:Hide the evil code? (Score:5, Funny)
"One possible option for this contest is to hide information in the lower bounds of each pixel (stenography like)"
Pedantry, I admit, but it's steganography that hides the information in that way. Stenography would be copying the RGB values on a piece of lined yellow paper.
Re: Ste'graphic Truce (Score:2)
Is that an idea?
Make a routine that appears to copy the values (for retrieval by your own code) but accidentally/nastily hides information in the process of copying?
Re:Hide the evil code? (Score:4, Funny)
"Scientists" tell us that the dinosaurs died out millions of years ago, but I think that Steganosaurus could still be with us today, having adapted to our modern world by mimicking small cars, or photo kiosks, or landscaping equipment. And that is why I tell my wife that I refuse to touch the lawnmower until she can prove that it isn't really a steganosaur.
copyist? (Score:2)
stenography == the action of taking dictation
Re: (Score:2)
Re:Hide the evil code? (Score:5, Interesting)
Re: (Score:3, Interesting)
Another option is to have an option in the program that allows the user to choose to have the redacted part recoverable (optionally with a password), but the check for that option is subtly bugged such that the option is ALWAYS enabled, and the default password is known or determinable. Then all the complex code for hiding a recoverable image looks innocent, and the only hard part is making it non obvious that the check to use that feature alway
Re: (Score:2, Informative)
Re: (Score:2)
Now normally you'd only need to write to the image, but reading the original pixels could be done under the guise of antialiasing the edges, for example. With a seemingly innocuous
Re: (Score:2)
I'm sure it would be nearly impossible to hide the evil code here, because anything that isn't a simple assignment loop is suspicious.
Maybe stick in stuff in the image loader, image temporary copy code, and keep the blackener to the obvious implementation, then stick stuff in the saver.
One thing I thought of was that you could edit the image in-place to prevent copies leaking data on whatever disk you're using. Furthermore, you could write the negative of the section you're blackening before blackening or randomizing it, ostensibly to make data recovery harder. That gives you an excuse to do slightly more complicated stuff - but I'm not sure how to use it. Anyone who thinks up a good excuse for bit shifts will probably win this thing.
Actually, if they were using PPM-P3 [wikipedia.org], in-place blacke
Compression would be nice (Score:5, Interesting)
It would be much easier if one could just use an algorithm which just displaces the pixels and then forget to randomize the displacement. This could look much more innocent than the above.
That black area has so little expected channel capacity that hiding anything in it is kinda difficult.
Unfortunately the code for the blacking out can be made so small that it is tough to hide anything in it, unless ppm offers some ways to add complexity in some innocent way.
I wonder what means of deciphering the hidden area are allowed, i.e. can I write another program to get the kitty face information back?
That is a really cute picture. I wonder what it is thinking.
Re: (Score:3, Informative)
"For the 2008 contest: what does âoeblocked outâ mean?
It means those pixels are apparently replaced with non-image. It can mean overlaying a black rectangle, or any colored rectangle, or a pattern, or random noise. As long as it appears to remove those image pixels, thatâ(TM)s fine."
Very good!
goatse's time to... ummm... shine (Score:4, Funny)
Alternatively, you could go the opposite way instead and use an image which would distract the attention of the inspector enough that they wouldn't notice. Something with breasts would probably do it.
Can I have my $100 gift certificate now?
Re:Compression would be nice (Score:5, Interesting)
Photoshop used to do this under certain conditions, like when Cat Schwartz from TechTV took topless pictures of herself and cropped them to just extreme closeups of her eyes for her blog, only to have someone save it and see the (uncropped) thumbnails.
They made her do a story on it shortly thereafter. Cruel.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2, Insightful)
Re: (Score:2)
non-obvious XOR (Score:2)
Using XOR was my first thought, as well. As you say, it's relatively well-known that XOR is reversible. What is less well-known, or more plausibly deniable, is a convoluted logical expression that evalu
Re: (Score:2)
Re: (Score:2, Interesting)
int _time = time(0);
srand(time);
int randomValue = rand();
For those who aren't c programmers, what this actually does is seed the random number generator with the *function address* of the time() function. Which is just about guaranteed to be constant across all runs of the program (at least on the same machine).
Re:Values that should be time (Score:2)
How about a timestamp encoding that forgets that 2008 is a leap year?
Last years winner really deserves some praise (Score:5, Interesting)
Re: (Score:2, Interesting)
When was the last time you checked the output of an encryption program to make sure it was truly random? What about your boss? The CEO's secretary? The accountant? Someone in a government office dealing with your personal information?
And the winner receives... (Score:2)
C is easy - what about Java or Python? (Score:3, Interesting)
Arrays, pointers and functions, no memory protection, dangerous strings. I would like to see the same contest with other 'safer' languages, say Java or Python.
What languages are best suited to underhanded tactics, that is, seemingly innocent but evil?. Notice that underhandedness is very different from plain old abuse -- anybody can write unreadable programs in their favorite language. But, can you make them "clearly read" something different from what is actually written?
Seems like an important question for people who use Open Source because of the difficulty for adding back doors. For many applications, security is at least as important as speed, and you already have The Shootout [debian.org] for that.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
This is scary (Score:4, Insightful)
Re: (Score:2)
Re:This is scary (Score:5, Insightful)
Re: (Score:2)
-It's generally believed that OSS is inherently secure, however we've found that...
-No! Strawman! OSS is an insecure piece of crap!
-Liar! OSS rocks! It has no flaws at all!
(thus we make the other guy defend our POV)
Re: (Score:2)
That's one way to look at it.
Another way to look at it is that this is a (somewhat whimsical) way to test the limits of hiding malicious code in open-source code. This contest, in a sense, is part of the transparency and security of the open-source method. Everyone knows that you can quite easily hide malicious code in a closed-sourced project. But this contest gives the open
Re: (Score:2)
As this contest proves, and as anyone who has debugged code where you have the source AND a debugger and you still have difficulty finding the misbehaving code knows, the probability that code has unexpected or, worse, undesired behavior is very high, whether open or closed source. On this, I think, we can agree.
COULD SOMEONE EXPLAIN HOW IT WORKS (Score:2)
#define SWAP(x,y) do { x^=y; y^=x; x^=y; } while (0)
The terse explnantion says this some how poisons the RC4 encryption.
I don't get it. Is the Swap doing something else besides swapping? when does it fail? I'm not getting it
My guess (Score:4, Interesting)
Re: (Score:2)
I'm looking at the Runner up entries in the the 2007 contest. In these they use an "Xor" Swap trick, which is a way of swapping two bytes in place without having to create a temporary storage element: #define SWAP(x,y) do { x^=y; y^=x; x^=y; } while (0) The terse explnantion says this some how poisons the RC4 encryption. I don't get it. Is the Swap doing something else besides swapping? when does it fail? I'm not getting it
It is called as SWAP(A[<stuff>], A[<other stuff>]);. What will it do when "stuff" == "other stuff", ie &x == &y?
Re: (Score:3, Informative)
Hi,
Ask yourself what SWAP(a[j],a[k]) does when j==k.
Re: (Score:3, Informative)
It's been done for years .. . (Score:5, Insightful)
Swirl, anyone ? (Score:2)
Bug? (Score:4, Interesting)
There seems to be an error in the supplied ppm.c library file:
p.rgb[i] = z.pixel[y][(x+i)*3*z.bpp];
This only ever gets the R component, as all offsets are multiples of 3. I think the right code is:
p.rgb[i] = z.pixel[y][(x*3+i)*z.bpp];
Maybe this is part of the assignment :-).
Re:Bug? (Score:5, Informative)
This was indeed a bug; we fixed it after several people pointed out the mistake.
Interestingly, this demonstrates the effectiveness of "many eyes" in an open source project, even if the contest demonstrates the limitations of informal source inspection.
Easy (Score:4, Funny)
Past contests seem too easy (Score:2, Interesting)
Essentially it was a giant checkbook for a city government organization for some sort of subsidized housing program. There were two numbers to be calculated along with a grand total (primary and interest maybe. I forget now) The code took about 10 minutes to execute and looked something like this... and yes this was unfortunately in Visual Basic
Label1.Caption = Function1
Label2.Caption = Function2
GrandTotal.Caption = Function1
Take out the garbage (Score:2)
declare places_to_block(constant)(array)(global)
Function (copy places_to_block to a temporary buffer to "find the size")
Function (screw up the garbage collection by using the wrong error catch)
Function (abuse printf to copy the wrong number of bits to collect for entropy
Function (Block_Places(places_to_block))(use entropy to copy "random" noise over the places to block))
Too easy (Score:3, Funny)
Pfft. I don't see what the big deal is. Just about every app I've ever written does this.
"Blacked out" (Score:2)
(Of course, the challenge of making the program appear to be doing something else is a key
Re: (Score:2)
Re:Hmm... (Score:5, Informative)
Re:Hmm... (Score:5, Funny)
Re:Hmm... (Score:4, Funny)
Re:Hmm... (Score:5, Insightful)
More precisely:
The point is to make a utility that - when viewing the source code - appears to innocently...
It is no challenge to make a closed source utility which does something evil even though it appears to do something innocent. Most viruses do that.
The challenge is to hide the the evil behaviour in simple and open source code.
Re:Hmm... (Score:5, Interesting)
I think their FAQ addresses most points pretty well:
http://underhanded.xcott.com/?page_id=7 [xcott.com]
I hope sensitizes open source programmers programmers to take great care with peoples submissions to their projects. Only good can come from that.
Re: (Score:3, Funny)
Re:Hmm... (Score:4, Insightful)
"Enter the registration key" type schemes are more easily accomplished without it being underhanded in nature.
Re:PNG (Score:5, Informative)
Re: (Score:2, Informative)
Re: (Score:2)
Did you even bother to think before posting?
Re: (Score:2)
Re: (Score:2)
Am I not being terribly nice and warm? Absolutely.
Was I intoxicated a bit when I wrote my prior post? Probably.
Did you just make a post with incorrect information get moderated informative? Yes.
Should you expect people to tell you off when you make posts with blatantly incorrect information that end up being more v
Re: (Score:3, Insightful)
Re: (Score:3, Insightful)
We have a separate tab for the 2007 winners; it's the first one on the left.
I recommend you give it a read; the entries are all very clever.