The First Annual Underhanded C Contest 341
Xcott Craver writes "We have just announced a new annual contest, the Underhanded C Contest, to write clear, readable, innocent-looking C code that implements malicious behavior. The object is to hide evil functionality that survives visual inspection of the source. The prize is beer."
Comment removed (Score:5, Funny)
how's this? (Score:5, Funny)
Re:how's this? (Score:3, Informative)
What you really want is something more subtle. For example, here's an easy one using rounding errors in the core of a smoothing algorithm. Assumes a picture of width x height of type "RGB" (assumed to be a typedef'ed struct containing bytes r, g, and b) in a two-dimensional array called
This will work (Score:4, Funny)
Re:This will work (Score:5, Funny)
Seems a bit like those hacking contests (Score:2)
Re:Seems a bit like those hacking contests (Score:5, Informative)
I mean I could do something like this:
# When do you want it done?
$today="sudo";
$yesterday="su -c";
# Define our globals
$superman="ls";
$wonderwoman="rm"
$bat
$aquaman="mv";
#define some important flags
$blows="-r";
$maims="-p";
$chunks="-f";
#define some targets
$your_mom="/";
$your_dad="/usr";
$your
$your_teacher="/bin";
$hell="/dev/n
$heaven="/dev/random";
$skyhigh="nfs://mys
#....later, back at Superfriends Headquarters
`$batman $blows $your_sister $skyhigh`;
`$wonderwoman $blows $chunks $on $your_sister`;
`$today $batman $and $your_mom $think $heaven $is $a $great $place $for $your_sister`;
#Would you like to see the rest of the story?
#print "Would you like to hear more? Please type your password to continue!";
The superfriends save the day again.
Re:Seems a bit like those hacking contests (Score:2)
It tried to remove the home directory itself!
Couldn't do it and it gave up without damaging any files.
Only severely misconfigured UNIX systems allow deleting one's own home directory, because the directory above your home, which is what you need permission on, you don't have write (you don't have
Nice as a proof of concept, but won't work anymore.
Re:Seems a bit like those hacking contests (Score:2)
in other words... (Score:4, Funny)
Re:in other words... (Score:4, Insightful)
Yes, I know that must come as a shock, and most people here probably won't believe me...yet it's true.
(And just to head off the inevitable nutcase looking for a Score:5, Funny: no, replacing the prize with free pr0n isn't going to cut it.
Re:in other words... (Score:3, Funny)
There you programmers go again... (Score:2)
Seriously, though, this is (obviously) a lot like the obfuscated c contest, but it's a cool idea, in that there's an important lesson to learn about evaluating code.
Re:There you programmers go again... (Score:3, Insightful)
Beer (Score:2)
Re:Beer (Score:3, Interesting)
It really just depends on what kind of plane you're talking about. I'm sure there's areas on even modern large-body jets where there's an uninsulated section large enough for a keg.
Beer? Phui! (Score:2, Funny)
The prize is world domination!
It's a bad idea (Score:3, Interesting)
C is a superb language. Why besmirch its reputation with a contest to make it seem as untrustworthy as possible?
Re:It's a bad idea (Score:5, Insightful)
Java gives you a polished floor on which you can slip and break your neck.
C++ gives you a thermo-nuclear device.
Re:It's a bad idea (Score:4, Funny)
Source [york.ac.uk]
Why assume C-specific tricks? (Score:2)
C is an awful language (Score:2, Informative)
You're just not used to it. (Score:5, Insightful)
A picky compiler is a blessing, not a curse. It's much easier to identify and fix compile errors than run-time errors.
difficult to convert to better languages (thank you preprocessor)
Meaningless troll.
encourages obfuscation
Unless the compiler is literally holding a gun to your head, this is meaningless. In C you have nearly limitless control to write your code the way you feel is clearest. If it came out obfuscated then you have nobody to blame but yourself.
some constructs are clearly tacked on and/or poorly implemented (switch), arbitrary nonorthogonality (struct, parens and brace usage, pointer/array declaration), shitty strings.
Tacked on? If you don't like the way constructs are set up then fine, that's your opinion. But if you read The C Programming Language you can tell that every single construct was scrutinized over for the proper balance of efficiency (why it makes sense to pass array parameters as pointers and structs as copies) and consistency (why data types are declared the way they are. Declaration and use of data is made to match.) Do you honestly believe the creators/first users of C, some of the greatest programmers who ever lived, really said, "Ahhh, fuck it. Let's just throw something together," when designing their own programming tools?
Most people who don't like C are really just saying they don't like low-level programming because that's what it was designed for, and that's what it's perfect for. Too many newbie programmers get used to some modern, flash-in-the-pan, all-things-to-all-people languages and when they are faced with the challenges of low-level languages rashly conclude that it's the language's fault they're having problems.
C is the perfect language for the job it was designed for. The same cannot be said for most more modern languages.
Re:You're just not used to it. (Score:3, Insightful)
I'm not sure about strings. With the really low level stuff like OS development, I can see th
Re:You're just not used to it. (Score:3, Insightful)
Clarity. All the data types in C are intended to be clear. It's only a single step up from assembly, really. C handles strings the same way assembly does: it eats bytes sequentially from an array, and it's up to the programmer to tell the program when it's had enough. Data handling in C is a virtually transparent veneer of abstraction from pointer arithmetic. A string
Re:You're just not used to it. (Score:3, Insightful)
I think you're confusing C with a high-level language. It doesn't give you lists, associative arrays, or strings because those are high-level data types and C is a low-level language. Your complaints are like saying the biggest problem with a car is you can't drive it on water -- they display a fundamental misunderstanding of the subject.
Re:You're just not used to it. (Score:4, Insightful)
Are you really going to want to wait 100s of milliseconds for a garbage collector to run at arbitrary intervals in your carefully word aligned DMA transaction code that needs to run within a matter of microseconds? And how exactly is Python, LISP, or any other interpreted/dynamic runtime compiled language going to be used to write a task scheduler or memory managment system worthy of being used in an OS kernel or embedded MCUs with barely 16KiB RAM?
I think you're quite bitter about having to use C for writing applications, which I can perfectly understand. As for what C is actually MEANT for, it does the job quite well. And yes, the preprocessor issues suck, and it would be nice to have Pascal strings, but there really is no alternative to C that I have seen for low-level programming. It makes computer science purists who think everyone should program in Haskell or LISP feel dirty, but it does the job very well. It sure beats writing directly in ASM.
Re:C is an awful language (Score:4, Insightful)
C is good for what it was first used for: writing Unix. At least initially, it was mimimalistic; orthogonality took a back seat to ease of implementation. (See Gabriel's classic essay [jwz.org] for details.)
(It's certainly not flawless. Any language that needs a utility like cdecl to make declarations understandable has problems, and there should've been a Boolean type from the beginning. It would be nice if char (which should be whatever represents a glyph on the target system) weren't conflated with short short int. Basically, if C were in your back yard, it would be declared an "attractive nuisance.")
I think the authors of The Art of Unix Programming wisely recognize that C, like any other tool, should be used only where appropriate. (Sorry if that's tautological, but I can't think of a better way to put it.)
Re:Indeed. This could be a field day for Java and (Score:3, Informative)
Re:Indeed. This could be a field day for Java and (Score:2, Insightful)
Re:Indeed. This could be a field day for Java and (Score:3, Insightful)
Actually, that's not really the case... not for the kind of "malicious code" that they're talking about here. They're not talking about "getting out of the sandbox", they're talking about "hiding information in the output". It's actually a lot easier to hide this kind of "malicious code" in an object-oriented language because you can play games with the namespace.
Re:Indeed. This could be a field day for Java and (Score:4, Informative)
Please check out the contest page: the "evil" behavior is not something java would prevent you from doing. We're not talking about crashing a computer or gaining root access, but performing a data processing task incorrectly. It's entirely problem state.
That being said, I chose C because it does permit more tricks along the lines of stack smashing and type mismatches. The winners of the obfuscated V contest used techniques like this to conceal their evil behavior, so I feel this would give people more freedom to get creative.
Finally, this is not meant to slam C, or open source, or any such like. I can't imagine how anyone can look at this contest and see it as an argument for less openness.
Xcott
Re:Indeed. This could be a field day for Java and (Score:2)
There are tons of C programs that look valid, but given some prompting can behave in arbitrarily evil ways.
If you want it to automatically behave in an evil way without a "little extra encouragement" then I suppose it would be a bit harder.
Story is just plain bad (Score:3, Insightful)
Yeah, I just flip the "+good +bad -malicious" flags on javac when I want to trust code. Come on
Re:Story is just plain bad (Score:3, Informative)
Have you seen Technocrat.net [technocrat.net]? Looks to be just starting, but I'm already impressed: slashdot ran an article on a nanotech textiles protest - technocrat ran one on a group of scientists demonstrating a refined iteration of a carbon nanotube CPU. Comments are on-topic too, touch wood.
(Or there's always ars [arstechnica.com] for CS stuff, but they're hardly a
So are you very, very good or very, very bad? (Score:2)
If you sincerely believe this is not a hard task, then you're either very, very good at programming, or really not very good at all.
Most developers aren't very good at writing clear, concise code that actually does what it's supposed to. Writing code of that quality that looks like it does what it's supposed to do, while actually doing something subtly different, sounds like a very difficul
C-style vs Java-style language features (Score:2)
I assume you're joking, since Java is as vulnerable to typical attacks like SQL injection just as much as many other languages, with just the same sort of careless slip in a couple of lines by a tired programmer...
If crashing is "malicious behavior" (Score:2)
Re:If crashing is "malicious behavior" (Score:2)
Re:If crashing is "malicious behavior" (Score:2)
Hmmm
There are more lines of non-crashing, non-malicious, well-designed, and well-tested lines of C out there than most other programming languages.
Re:If crashing is "malicious behavior" (Score:3, Funny)
Nope. Only the code that includes
#include <windows.h>
*ducks*
How will the judges be able to trust this code? (Score:2)
Re:How will the judges be able to trust this code? (Score:2)
The judges will expect that (Score:2)
If they didn't do this, you can bet that someone would try to write a program which would detect competitors' programs running and disable them.
I think I might win (Score:4, Funny)
main()
{
printf("Hello World");
}
Seemingly harmless, right? Wrong. It's still in devlopment, but think about it. You should have to greet the world before you destroy it.
I think this is more appropriate (Score:3, Funny)
main() { printf("Goodbye World!\n"); }
Re:I think I might win (Score:2)
This year's challenge (Score:2)
Re: This year's challenge (Score:5, Informative)
Why, yes! http://sourceforge.net/projects/steghide/ [sourceforge.net]
Re: This year's challenge (Score:2)
Re: This year's challenge (Score:2)
Re: This year's challenge (Score:2)
Well, if you're Yoda, then you can just use the Force to do it.
my submission (Score:2)
Strange (Score:2)
like this? (Score:5, Funny)
void main()
{
screensaver(); * function */
anyone that thinks there is * / needs */
}
585
Re:like this? (Score:5, Funny)
Re:I'll take the bait (Score:3, Informative)
You are correct. This is from ISO/IEC 9899:1999(E):
Attack the Compiler (Score:5, Interesting)
You need only attack the compiler, or the linker, or the interpreter.
Re:Attack the Compiler (Score:2)
Re:Attack the Compiler (Score:2, Informative)
Re:Attack the Compiler (Score:3, Insightful)
I guess the thing is: What we're really concerned about here, (if I may project a little,) is voting software.
In those cases, they're probably not going to say, "download the compiler from a random site on the net." In fact, it's probably going to be very hard to control the people who compile the software, and even harder to control the people who compile the compiler. At some point, somebody's going to get the compiler, and they're going to get it from some specified place.
If it's a se
Here you go (Score:5, Funny)
Just tuck it away in a commonly used header file, use touch to restore the last date/time of modification, and you're all set.
#define void int
Hours & hours of irritation & confusion!
T&K.
Diebold (Score:2, Insightful)
Now if only we can get them to enter their code in the contest...
Re:Diebold (Score:3, Funny)
It's supposed to survive inspection, remember. giveElectionToTheRepublican() is underhanded, but it probably won't survive inspection.
Why? (Score:4, Insightful)
Who is behind this and what is their motivations? What will they do with the ideas submitted in this contest? In a day of professional computer hackers, this is not a contest to have.
Re:Why? (Score:5, Insightful)
It is sort of like the computer version of a bomb squad.
Re:Why? (Score:3, Informative)
Something like:
if (blah || blah || uid=0) {
blah;
}
Re:Why? (Score:2)
OR
Having contests like these creates a sample base of dangerous code and clever tricks that evil doers can use to craft subtley malicous code in open source projects.
Re:Why? (Score:2)
Who is behind this and what is their motivations? What will they do with the ideas submitted in this contest? In a day of professional computer hackers, this is not a contest to have.
Dicionary.com describes simulacrum [reference.com] as,
1. An image; a representation.
2. An insubstantial, superficial, or vague likeness or semblance.
So, Mr Simulacrum25 (if that is indeed your real name!), care to tell us why you're so scared of other people looking in to ways of secretly concealing informatio
Re:Why? (Score:4, Informative)
Is Google down? Okay, I updated the faq to tell you who we are.
Also, we never said anything about hackers. Nowhere have we associated hacking with malicious behavior. And I sincerly hope this will be a learning experience for all involved. I, in particular, will probably learn a thing or two about running next year's contest.
Xcott
Here's my entry: (Score:3, Funny)
root (hd0,0)
chainloader +1
Now where's my beer?
Diebold Hiring the winner! (Score:4, Funny)
Diebold needs new programmers. If you have what it takes to hide "winning" code in our election machines. Apply to Diebold Careers [diebold.com]
Cheating? (Score:3, Funny)
Would the Windows source code count? (Score:2, Funny)
Subtlety (Score:5, Funny)
Re:Subtlety (Score:2)
Re:Subtlety (Score:2)
Obligatory simpsons paraphrase (Score:5, Funny)
Judge: 'That's bad.'
Programmer: 'But it's optimized for PowerPC!'
Judge: 'That's good!'
Programmer: 'PowerPC is also cursed.'
Judge: 'That's bad.'
Programmer: 'But you get your choice of operating systems!'
Judge: 'That's good!'
Programmer: 'The operating systems run on Intel.' *pause* 'That's bad.'
Judge: 'Can I go now?'
Re:Subtlety (Score:3, Informative)
I've tried their Rare Vos, Hennepin, and self-named Ommegang beer: my favorite is the Rare Vos but I like them all.
Obscurifacation (Score:2)
Especially useful on large programs it pretty much made the source totally unreadable, and a complete headache to try to unravel even if you countered with a similar program - because all meaning in the origin
An example from years ago (Score:5, Interesting)
Re:An example from years ago (Score:4, Informative)
Some dude from Microsoft is gonna win... (Score:5, Funny)
He'll submit the source code to IE.
When will we see this pop up in the real world? (Score:2, Interesting)
Every year, we will propose a challenge to coders to solve a simple data processing problem, but with covert malicious behavior. Examples include miscounting votes, shaving money from financial transactions, or leaking information to an eavesdropper. The main goal, however, is to write source code that easily passes visual inspection by other programmers.
Oh dear, now we're rewarding people for writing actual malicious code that is designed to pass visual inspection from other programmers.
When these s
The prize is beer (Score:2)
Well, nothing could go wrong here, since we all know that all C programmers are over 21. And if by any chance the winner wasn't over 21 they would make that clear and refuse their prize.
The next day the headlines read" " C Programmers Give Minors Beer, Drunken Night of Celebration Kills 6 in Traffic Acciident ". Reactionary congressmen urged on by a powerful lobby from Washington State quickly pass laws to outlaw all C programming outside of Microsoft.
here's my entry (Score:4, Funny)
easy (Score:2, Interesting)
Service Pack fixes it, but it's documented (Score:5, Informative)
Linux Kernel Backdoor Attempt (Score:5, Informative)
The attempt was trying to insert
if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
inside a function. Note that (current->uid = 0) is not testing but rather sets the UID to zero (and the surrounding brackets avoid the GCC warning).
So The Hard Part Is To (Score:5, Funny)
Wow, nobody's going to win this one.
Vectors (Score:3, Informative)
A way to automatically find this would be to use an execution tracer that would alert you when the programs point of execution "left" it's source code or allowed system api's.
Volunteer to help out! (Score:3, Interesting)
This would make the test more like the real world too.
Re:What are the legal ramifications of this? (Score:3, Funny)
Re:What are the legal ramifications of this? (Score:3, Informative)
RTFA, please.
The challenge for the first UCC is to write a simple program that performs some basic image-processing operation, for example smoothing or resampling, but manages to conceal a unique imperceptible fingerprint in each image it opens.
The fingerprint should be different for every execution of the program. It doesn't have to have any particular meaning, but useful tracking information is worth extra points (tho getting caught is worth fewer points.) The print should be extractable from the o
Re:What are the legal ramifications of this? (Score:2)
Are you serious? Entrapment is an undercover cop asking you if you want to buy drugs, then when you say no, he tries to persuade you and suceeds, possibly becuase you just want him to go away.
It's really not that easy for something to qualify as entrapment, also consider that writing malicious code isnt illegal, it's free speech and no different then writing a book that urges people to do something malicious, not at all illegal.
But no please, keep thinking everything is illegal and dont bother doing
Re:What are the legal ramifications of this? (Score:4, Insightful)
The authorities start a contest such as this, an unsuspecting programmer submits a malicious program, and he or she is arrested and charged with a variety of computer crimes.
What computer crimes would be broken?
Frankly, I won't participate in this contest considering the current legal state of America.
No, you won't participate because of yor current state of paranoia over the legal state of America.
Re:What are the legal ramifications of this? (Score:5, Funny)
Re:SxE anyone??? (Score:3, Funny)
What if someone in the straight edge crowed wins?
They can give the beer to me.
Re:SxE anyone??? (Score:2)
Re:Possibly obfuscated intentions (Score:2)
It also means that an army of coders have considered and may recognize numerous different approaches to hiding this kind of watermarking.