Obfuscated Vote Counting Contest
Daniel Horn writes "In a flash of inspiration coming from the Obfuscated C code contest and the current E-voting scandals, I wondered if there shouldn't be a similar code obfuscation contest based on obfuscating voting results, that is, C code that appears correct but does the wrong thing when counting votes. Submit your obfuscated vote-counting code now, and the two winners will be selected on November 2 and will receive a free Vega Strike CD. Obviously incorrect code, however, is not welcome."
Quick, someone post some of the Diebold voting machine code, you certainly will have a winner in there!
I was going to submit the Diebold code till I read:Obviously incorrect code, however, is not welcome.
Monstar L
If I were doing this, I would hide the date analysis and vote rigging in another part of the program. For example, the code used to handle the screen and menus, or the network stack.
Then, you could obfuscate a call to jump the program pointer to that part of memory directly, run a tiny bit of code that appears to deal with graphics, but does something else when called with the correct offset.
The devious would be scattered about, rather than in one single vote counting function.
enum Outcome
{
AMERICAWINS,
AMERICALOSES
}
int main()
{
bool voted = didYouVote();
Outcome o;
switch (voted)
{
case true:
o = AMERICAWINS;
case false:
o = AMERICALOSES;
}
return o;
}
"C code that appears correct but does the wrong thing when counting votes"
Beware of Diebold suing you for infringing one of their patents !
This seems to be similar to Dr. Avi Rubin's challenge to the community, which basically states that a team of security specialists and programmers should be given access to the development environment of one of the major DRE machines, by the vendor. The team should then attempt to rig the machine in favor of one candidate, and then submit the machine for approval by the elections board's testing agency. The testing agency doesn't know it's being tested, and doesn't know the machine is rigged. Could they catch the rigged machine as they currently claim? It's the same basic principle as having undercover agents attempt to sneak weapons through airport security.
The paper can be found at:
http://avirubin.com/vote/ita.challenge.pdf
Intercarve Networks, LLC
Why create code that distorts the voting results, Diebold has already done it.
My favorite story was a county in Pennsylvania (if I remember correctly, it's in this months Readers Digest) where the electronic voting machine correctly counted all 144,000 votes. Except there were only 19,000 registered voters in the entire county.
We're screwed in this election. It is going to make the 2000 Florida crap look like a cakewalk.
Lose Weight and Feel Great with Isagenix
int KerryVotes=0;
int BushVotes=0;
void ParseVote(const char* v) {
if(!strcmp(v,"Kerry")) {
KerryVotes++;
} else if(strcmp(v,"Bush")) {
BushVotes++;
}
}
11*43+456^2
Surely you know that C and C++ don't give a damn if there are new lines and carriage returns in the whitespace or not.
Only newbie programmers use new lines and carriage returns.
Real programmers don't use new lines and carriage returns as it detracts from being able to glance at the whole program at once and immediately understand it's intent, purpose, and spot any bugs in a holistic fashion.
Well, you must have misread. They use Windows CE. I shit you not.
"Anyone who attempts to generate random numbers by deterministic means is living in a state of sin." -- John von Neumann
forgetting strcmp() returns 0 when strings match are we?
In addition to the mistakes others noticed: what's an elsif?
Nater is a Basketball player, Nader is a presidnetial candidate.
And they both have the same chances of becoming president.
Stop the world; I need to get off.
Dan Wallach is teaching a course at Rice that, I think, includes this sort of challenge.
>
> In fact, just forget to vote alltogether, not like your vote counts, right?
I dunno, I'd think that being able to hack the best-hidden trapdoor into the voting system would make your vote count for quite a bit!
STALLMAN-BALMER 2008!
I am a viral sig. Please help me spread.
C code that appears correct but does the wrong thing when counting votes.
Does it have to be a C code? In my opinion C is not nearly obfuscatable enough. What about BF or Unlambda? Or, better yet, Lingua Romana Perligata? Now when I'm thinking about it, I think PASM might be perfect for such a task, if only-- I know! Acme DWIM or Bleach compiled directly into PASM! With JIT!! Dear God, that would be so cool!!! But wait, they want C code, right... Wait a minute, Perl is written in C! So is Parrot! And they can be embedded in a C program! Sweet Heavens! What an idea!!!1 Gotta go.
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
if(voter.ethnicity != WHITE)
return 0;
if(GetVote(&voter))
{
switch(voter.vote)
{
case BUSH:
case KERRY:
++BusinessAsUsual;
break;
default:
AlertFBI();
}
}
> if (vote==candidate_1)
> candidate_1_count++;
>
> On an 32-bit machine, this will count up to 2 billion votes before the counter rolls over and goes negative. On a 16-bit machine, 32,000 votes. On an 8-bit machine, 127 votes. So, if I'm a Democrat, I'll make sure to put 16-bit versions of this machine in precincts such as East Buttfuck, Texas, which has a popuation of around 25000.
Likewise, if I'm a Republican, I'll put a 16-bit version of this machine in inner city areas with populations ranging from 18000 to 50000.
And if I'm really smart, I'll change the sizeof() an int to 15 or 17 depending on the number of votes I want to count, and the number I want to overflow. Spinning it to computer-illiterate civic officials would be as simple as having my salesguy say either "Because you have more people to count up, you get the 17-bit version. It's one better than the 16-bit version, but we can offer it to you at the same price", or "We'll let you save $500 per unit by going to the 15-bit version, which is suitable for smaller districts such as yours."
It would be interesting if contestants could defeat the statistical methods used to uncover fraud mentioned elsewhere on that blog.
you had me at #!
The best way to do this would be a variant of Ken Thompson's cc hack, published in ACM back in 1984. Basically the voting code would be pristine, but the compiler itself would be modified to add in "features" at compile time. The compiler also had hooks to add in the trojans while compiling pristine compiler code.
Both compiler and voting application code would appear pristine, with the the actual hack existing only in the compiled code.
try to make a point and the only thing people notice is the syntax errors... only on slashdot
Indeed. Everywhere else normal people would just get the point presented in the form of a C program, but not the nerds on Slashdot! But seriously, I was sure that all of the errors in your code was just meant to be examples of real errors that might change the election outcome:
All in all, not counting the Perlish elsif there are no syntax errors, while every single logic error might be used on purpose in a vote-counting code to change the election outcome while being hard to spot in a large and complicated spaghetti code. Did I really miss something?
Actually, I was very surprised reading all of the posts fixing the bugs in your code. "Weren't such bugs the whole point of a contest writing 'C code that appears correct but does the wrong thing when counting votes' after all," I thought to myself? [emphasis added]
But now I am even more surprised! Were those really unintentional errors? Because when I first read your comment I though: "What a brilliant example with so many subtle errors in every single statement!" Have I really overestimated the brilliance of your code? I do really hope that I have not, because it was surely one of the best examples posted so far, the foolish down-moderation notwithstanding.
Was I completely wrong? Doubtful. Was I fooled? I don't think so. Am I stupid? Highly unlikely. So what's wrong?
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
Which made me wonder whether when, during the third debate, President's Bush boasted that, "the first person to vote in that election was a 19 year old girl", he might also have been correct to say that she was the second person, and the third person ...
This statement is forty-five characters long.