Slashdot Mirror


5th Underhanded C Contest Now Open

Xcott Craver writes "The next Underhanded C Contest has begun, with a deadline of March 1st. The object of the contest is to write short, readable, clear and innocent C code that somehow commits an evil act. This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field. The prize is a gift certificate to ThinkGeek.com."

162 comments

  1. Watch list? by girlintraining · · Score: 4, Funny

    This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field.

    All participants will also receive complimentary cavity-searches at airport checkpoints.

    --
    #fuckbeta #iamslashdot #dicemustdie
    1. Re:Watch list? by RichardJenkins · · Score: 3, Funny

      Uh-oh, looks like you got missed out the punctuation and got the words in the wrong order! You clearly meant:

      God, is stupid science there? Is that religion? Get some religion! Karma should fuck me good.

      Yeah, that makes more sense.

    2. Re:Watch list? by clang_jangle · · Score: 0, Troll
      Oooh! Let me try one:

      God is. Stupid science! There -- Is that religion? Get some! Religion, karma should... Fuck me good!

      --
      Caveat Utilitor
    3. Re:Watch list? by w0mprat · · Score: 4, Funny

      This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field.

      I am certain that this is already a feature of existing luggage routing software.

      --
      After logging in slashdot still does not take you back to the page you were on. It's been that way for 20 years.
    4. Re:Watch list? by girlintraining · · Score: 0

      I am certain that this is already a feature of existing luggage routing software.

      It's not a misfeature, it's a Bohr bug.

      --
      #fuckbeta #iamslashdot #dicemustdie
    5. Re:Watch list? by markkezner · · Score: 5, Insightful

      Funny, but you've got a point. What would a potential employer think when, upon googling your name, they learn that you're so good at hiding malicious code that you won a contest for it. Would you hire that guy?

      It's not worth the $100 gift certificate.

      --
      Dangerous, sexy, turing complete: Femme Bots
    6. Re:Watch list? by FenwayFrank · · Score: 1

      All participants will also receive complimentary cavity-searches at airport checkpoints.

      Second prize: two of them.

    7. Re:Watch list? by Applekid · · Score: 4, Insightful

      Would you hire that guy?

      Definitely, but maybe for QA or as a Code Review consultant. Of course, I'm assuming that the winner of the contest would also be clever enough to detect hidden maliciousness in others' code.

      --
      More Twoson than Cupertino
    8. Re:Watch list? by SamAdam3d · · Score: 1

      You think any of these guys are going to submit with their real names? Nah, they'll spend the extra 10 minutes to come up with a super-sweet hacker name.

      --
      I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams
    9. Re:Watch list? by Anonymous Coward · · Score: 0

      yes it is. Dude, that's like 3 sets of buckyballs.

    10. Re:Watch list? by girlintraining · · Score: 0, Offtopic

      Funny, but you've got a point.

      The best humor also makes a good point. Thanks for noticing.

      --
      #fuckbeta #iamslashdot #dicemustdie
    11. Re:Watch list? by Ksevio · · Score: 1

      Why? My teeth are fine!

    12. Re:Watch list? by Anonymous Coward · · Score: 3, Funny

      Yes, especially if the word "fragile" or "valuable" is in the comment field.

    13. Re:Watch list? by the_fat_kid · · Score: 1

      more like a complimentary DMCA take down for reproducing the current system.
      I mean, realy, isn't this what it does now?

      --
      -- Sig under construction...
    14. Re:Watch list? by Anonymous Coward · · Score: 1, Funny

      You mean like zerocool?

    15. Re:Watch list? by Razalhague · · Score: 1

      Crash Override is much cooler. Though I'm also partial to Cereal Killer.

    16. Re:Watch list? by bonch · · Score: 1

      That's pretty paranoid of you. The point of the contest is to illustrate your knowledge of esoteric bugs as a lesson to all. You don't want to work for an employer who sees your programming awareness and experience as a negative.

    17. Re:Watch list? by mea37 · · Score: 1

      I agree, but GP has a point even if he asked the wrong question.

      Would I hire him? Sure - or at least, this wouldn't weigh against him. The guy I worry about has the same skills, but doesn't advertise them by participating in this contest because he intends to actually use them.

      But whould a lot of IT managers see it as a negative and decide not to hire him? Yes, they would. Like it or not, a lot of perfectly good jobs (and remember, for a couple years out of any given decade, "perfectly good" is likely to just mean "paying") are controlled by people who will not understand the contest's purpose or the positives that are implied by doing well at it.

    18. Re:Watch list? by clang_jangle · · Score: 0, Offtopic

      (Score:-1, Troll)

      I feel so misunderstood...

      --
      Caveat Utilitor
    19. Re:Watch list? by InterStellaArtois · · Score: 1

      "Hex Pest"

    20. Re:Watch list? by Anonymous Coward · · Score: 0

      The best humor also makes a good point. Thanks for noticing.

      Normally I'd agree but with this new breed of ironic comedy I find that I can listen to Rush Limbaugh for hours, laugh my ass off, and not hear a single good point.

    21. Re:Watch list? by gad_zuki! · · Score: 2, Insightful

      >What would a potential employer think when, upon googling your name, they learn that you're so good at hiding malicious code that you won a contest for it.

      Thats a pretty lousy line of reasoning and probably responsible for all the mediocrity out there in the computer world. Heck, what if your employer found out you were in the military and fought? Do you want to hire the guy who shot at Iraqis with a 50 caliber machine gun? Or the guy who wrote an ad blocking program? Or the guy who wrote a cover letter well enough to fool you into interviewing him?

      Yes, you do because all these things are signs of courage and intelligence. Once you start filtering anyone with any background in anything controversial, powerful, different, or mildly questionable then you can pretty much guarantee yourself a staff of dim bulbs and products that do miserably in the market.

      This is also why I think its so hard for smart people to be in politics. The electorate is so scared of anything that deviates from the mainstream that we only vote in conformist 'never rock the boat' overly-religious men, who turn out to be good at not cheating on their wives and going to church but not so good at governing and coming up with and implementing good solutions for the public good.

    22. Re:Watch list? by Anonymous Coward · · Score: 0

      You got it all wrong, you need to use 'C Real Killer', which can either refer to the fact that they mistook you for the real killer, or that you're the real killer of C programming :)

    23. Re:Watch list? by dangitman · · Score: 1

      Definitely, but maybe for QA or as a Code Review consultant. Of course, I'm assuming that the winner of the contest would also be clever enough to detect hidden maliciousness in others' code.

      You employ people to work in your Mom's basement? You must get one heck of an allowance.

      --
      ... and then they built the supercollider.
    24. Re:Watch list? by story645 · · Score: 1

      who turn out to be good at not cheating on their wives

      Since when?

      --
      open source modern art: laser taggi
    25. Re:Watch list? by jonadab · · Score: 1

      > we only vote in conformist 'never rock the boat' overly-religious
      > men, who turn out to be good at not cheating on their wives...

      Right. Which President are you referring to?

      Barack Obama is practically the opposite of conformist, ramming his program down everyone's throats, including the congresspersons of his own party. George W. Bush rocked the boat all over the place, taking us to war when a good chunk of the world was adamantly against it, not once but twice. Clinton is mostly known for cheating on his wife. Do I really need to go through the whole list?

      --
      Cut that out, or I will ship you to Norilsk in a box.
    26. Re:Watch list? by clone53421 · · Score: 1

      All participants will also receive complimentary cavity-searches at airport checkpoints.

      Actually, I fully expect the entries to receive this very sort of examination...

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    27. Re:Watch list? by gad_zuki! · · Score: 1

      By US standards going to war on a whim isnt rocking the boat. Implementing universal heatlhcare or socialized higher education is.

    28. Re:Watch list? by Anonymous Coward · · Score: 0

      What would a potential employer think when, upon googling your name, they learn that you're so good at hiding malicious code that you won a contest for it. Would you hire that guy?

      I am fairly sure that you are able to hit someone on the head. Should I hire you or not, based on the risk of you hitting some colleague on the head?

      Stupid reasoning.

      Of course I would hire such a person. Obviously talented. I always assume people have some sense of ethics until I see a reason not to. How do you survive in this world?

    29. Re:Watch list? by Geminii · · Score: 1

      Current routing software stops before the "if".

  2. Re:This sounds familiar to, by Anonymous Coward · · Score: 0, Insightful

    Yes, because no one but a C programmer could ever do such a thing. Fuck you.

  3. Not fair! by Anonymous Coward · · Score: 3, Funny

    Someone who works at any major airline can just submit the real production code they use for luggage routing and win the contest for sure!

    1. Re:Not fair! by fuzzyfuzzyfungus · · Score: 4, Funny

      Hardly. It is supposed to be "short, readable, clear and innocent". What are the odds that any of the airline production code meets that description?

    2. Re:Not fair! by BrokenHalo · · Score: 1

      What are the odds that any of the airline production code meets that description?

      How it's written probably doesn't matter. Heathrow Airport has almost certainly patented the invention, and will go after the winner(s) of the competition with every platoon of lawyers at its disposal.

    3. Re:Not fair! by girlintraining · · Score: 2, Interesting

      Hardly. It is supposed to be "short, readable, clear and innocent". What are the odds that any of the airline production code meets that description?

      Depends on the function -- if it's mission critical, you bet your ass it'll be documented and readable. Considering that most ATC technical failures are hardware, not software-based, that should say something. The problem is that while the code is quite well-documented, few people are left with the training or understanding of it to port it to newer systems, and it's not like they can ground all flights for a week to do an upgrade. So we're left with mainframes that were out of date in the 70s being used today being used in critical infrastructure.

      On the other hand, the code in applications used at the ticket counter and security checkpoints... not so much.

      --
      #fuckbeta #iamslashdot #dicemustdie
    4. Re:Not fair! by Anonymous Coward · · Score: 1, Funny

      Not to mention that their production code is probably written in COBOL. And that wouldn't be fair - everything written in COBOL is underhanded.

    5. Re:Not fair! by Reziac · · Score: 1

      include airport.c
      baggage==random();

      Something like that?

      (IANAP, obviously :)

      --
      ~REZ~ #43301. Who'd fake being me anyway?
    6. Re:Not fair! by PPH · · Score: 1

      The problem is that while the code is quite well-documented, few people are left with the training or understanding of it to port it to newer systems,

      Because its written in COBOL, and when any new analysis/developers come in and suggest porting it to something else, all the geezers clutch their hearts and moan.

      We've had tools to reverse engineer, document and port code from practically any language to any other for years (a decade in cases I'm familiar with, actually). There's no excuse for keeping dead languages or platforms around any longer.

      and it's not like they can ground all flights for a week to do an upgrade.

      Nobody just pulls the plug on an old system, rolls in a new one and says, "Boy, I hope this will work!" Even for non mission critical systems. There are numerous methods for running commissioning tests, parallel checkouts, etc. that one can use to make changeovers seamless. The claim that a changeover will require a shutdown and cause chaos is usually an argument the geezers make when someone threatens to take their old mainframe away.

      --
      Have gnu, will travel.
    7. Re:Not fair! by Skater · · Score: 2, Interesting

      Does anyone else remember the new Denver Airport's original luggage system? This system singlehandedly delayed the airport's opening for over a year. Eventually the airport retrofitted a standard baggage moving system. If someone has access to the code of the original system, they could easily submit that.

    8. Re:Not fair! by derGoldstein · · Score: 3, Insightful

      Hardly. It is supposed to be "short, readable, clear and innocent". What are the odds that any of the airline production code meets that description?

      Hardly. It is supposed to be "short, readable, clear and innocent". What are the odds that any software written in C meets that description?

      There, fixed.

      --
      Entomologically speaking, the spider is not a bug, it's a feature.
    9. Re:Not fair! by Anonymous Coward · · Score: 0

      The current system used for tracking luggage is a matryoshka doll of emulated systems within systems. The innermost layer is a virtual machine simulating a punchcard reader - that's why the tags have an 80 character limit.

    10. Re:Not fair! by quanticle · · Score: 1

      Airlines don't write Air Traffic Control code. That's the FAA's job. The luggage routing software that routes your bag to Boston when you're going to New York is the airline's responsibility.

      Also, there's no guarantee that "mission critical" implies readable or documented. Arguably, the reason the FAA is having so much trouble introducing a new flight control system is that the old one is so poorly documented, porting it to newer hardware is extremely difficult.

      --
      We all know what to do, but we don't know how to get re-elected once we have done it
    11. Re:Not fair! by Anonymous Coward · · Score: 0

      I'm so worried about the baggage retrieval system they've got at Heathrow.

    12. Re:Not fair! by clone53421 · · Score: 1

      Depends on the function -- if it's mission critical, you bet your ass it'll be documented and readable.

      Not if someone bet their ass it won’t crash inexplicably and need to be fixed or rewritten.

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    13. Re:Not fair! by nortcele · · Score: 1

      Relax. No one is going to submit the .bat file currently used to route luggage.

  4. Wait a sec... by Anonymous Coward · · Score: 4, Funny

    | This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field.

    What, we actually need to write code for something that happens by nature?

    1. Re:Wait a sec... by bcong · · Score: 4, Funny

      the current method of writing in:
      "Package Handler,
      Customer was an asshat...you know what to do"
      was starting to get noticed

    2. Re:Wait a sec... by Anonymous Coward · · Score: 0

      Updated to:
      "Fragile: please handle with care"

      It's only triggered with the "please" part included :-)

    3. Re:Wait a sec... by derGoldstein · · Score: 1

      What, we actually need to write code for something that happens by nature?

      Their logic is sound:
      Code written not to make this mistake will make it. How do you solve the problem? Write code that does make the mistake. The resulting software will then, logically, avoid making the mistake.

      --
      Entomologically speaking, the spider is not a bug, it's a feature.
  5. Why not, I suppose. by Anonymous Coward · · Score: 0

    This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field.

    Eh, why re-invent the wheel? The software already in use does a good enough job of that already.

  6. Easy? by Monkeedude1212 · · Score: 1, Interesting

    Public Static String default_Address = "1600 Pennsylvania Ave NW, Washington, DC 20500, USA" --- hide this somewhere

    Private Sub Void Route_Bagggage(bag b)
    {
    if (comment.text == NULL)
    {
    b.destination = default_Address
    }
    else
    {
    b.destination = comment.text
    }
    }

    Or do I have to make it slightly more deceptive?

    1. Re:Easy? by Anonymous Coward · · Score: 5, Informative

      *Way* more deceptive. The default value for the destination field? It's supposed to look innocent - an innocent program would note that you left out a destination and prompt you to enter one. Any basic debugging done by someone else would turn this up. What they want is for you to leave a "comment" like "this package is top-heavy" (in a field designed for such comments) that changes the destination, but in a way such that someone reading the source code wouldn't realize anything was happening at all much what that you were changing the destination. Also such that whoever entered the text wouldn't obviously be at fault.

    2. Re:Easy? by Monkeedude1212 · · Score: 1

      LoL - I know.

      But wouldn't that be as easy as testing for whatever the secret comment is (for example, top-heavy) - when that's true, set off a top heavy flag (boolean). Then go somewhere towards the end of the Example, for example the final routing stages, where the destination has already been set by the clerk and confirmed it - and alter the shipping address that way? Like say the overview stage where they clerk reviews all the information, then submits it.

      I mean - to me, I cannot think of a single scenario where someone going through with a debugger won't be able to catch this on their first shot. Just put a watch on the destination values, and step over/through until one or more changes. Since its likely a large infrastructure, with thousands of lines of code, thats why I say sneak it in towards the end, since no one is going to want to step through the WHOLE process.

    3. Re:Easy? by Bandman · · Score: 1

      I'm thinking the best way would be an overflow in an array that flips the most significant digit of the target zip code. But I'm not a coder, so someone else can steal my idea.

    4. Re:Easy? by travdaddy · · Score: 1

      Yeah, sounds like that second one would fulfill the requirements. Unlike a lot of other tech contests like the X Prize and Netflix, I don't think the contest is meant to stump a lot of the competition. So, the question becomes whether or not the code is simple enough and underhanded enough to be the absolute best out of however many hundreds of entries there will be.

      --
      Adidas To Bring Back Sneakernet
    5. Re:Easy? by Anonymous Coward · · Score: 1, Interesting

      In other words, you need to replace an == with an = in just the right location (or vice versa) so that while it looks like you're doing a sanity check, you're actually assigning a stealth variable.

      To make it even better, you need to set it up so that this causes a buffer overflow, and you're actually overwriting another variable. THEN, you go back and do a sanity check on the original value which corrects the mistake caused by the ==/= replacement. That way, someone sees the mistake, but sees that it is properly handled and doesn't think twice about it.

      Meanwhile, the adjacent address field has just been overwritten, and unless you're checking for overflows, you're unlikely to notice, unless you've already isolated the variable in a debugger. However, in this case, you're going to catch it no matter what... unless it's the pointer that gets overwritten and while you're watching the variable, it just doesn't get called anymore (even though the code implies that it does).

      Sounds like fun :)

    6. Re:Easy? by Tyler+Durden · · Score: 4, Funny

      C motherfucker, do you speak it?!

      --
      Happy people make bad consumers.
    7. Re:Easy? by Anonymous Coward · · Score: 1, Informative

      You're still missing the point. Yes, it would be really easy to make a program that changes the destination based on a particular value in the comment field. It would also be really easy to see that someone did that. What is difficult (and worthy of a contest) is changing the destination based on a particular value in the comment field in such a way that a simple debugging wouldn't find it (assuming they don't know what the secret comment is in advance).

      Properly done there would be no boolean indicating the presence of the comment, and the value of "Destination" might never change. Instead at the end there would be some code that verified that all fields were properly formatted and send them to the printer, and some clever code at this point would subtly change what was outputted as the destination based on the contents of a particular comment field. Maybe some combination of the conditional operator and regular expressions would allow you to cleverly add 1 to all numbers in the destination if some condition is true, such that "1234 main street" becomes "2345 main street". (Something more clever then "comment == 'top-heavy'", based on regular expressions and/or hashes)

      But yea, doing it such that not only can nobody tell what's happening but such that they don't know *anything* is happening is difficult. That's why it's a contest.

    8. Re:Easy? by Hurricane78 · · Score: 1

      Yeah. You easily failed! ^^

      The whole point of the contest is, that there is no “hide somewhere”. All the code must pass an inspection and look reasonable.

      --
      Any sufficiently advanced intelligence is indistinguishable from stupidity.
    9. Re:Easy? by aztracker1 · · Score: 1

      Well, if you have special comment categories from an enum, then you could have a switch/case statement that does a few things, where the comment inspection could seem less obvious... HandleComment(enum comment1, string comment2, string comment3) { switch(comment1) {... case myenum.sizeRestriction: if (comment2 == "top heavy") this.RouteToFrontOfPlane(); ... } RouteToFrontOfPlane() { this.DelayLoading(); this.PushToFront(); } ... with DelayLoading() making one change, then PushToFront() doing another, the combination of would route out the package to a bad location. Inspecting any of the above would be fairly innoculous, and innocent looking... But it would only be the original code path that would cause the issue to present itself.

      Not a difficult challenge at all really. Of course I make a habbit of sniffing out thread-safety issues in the code I work on.

      --
      Michael J. Ryan - tracker1.info
    10. Re:Easy? by Anonymous Coward · · Score: 0

      How about a hash code selecting the destination? The problem would be how to make the hash function depending of the comment field. Perhaps a buffer overflow could do it.

    11. Re:Easy? by Anonymous Coward · · Score: 1, Informative

      Well if you think it's easy, why not try submitting something? There's a good chance the winners will have far better solutions than you were expecting.

      Remember there's a few parts to this. It's supposed to be simple, hidden in plain sight, and once discovered, it can't look intentional.

      Read the challenge. If your program mentions anything at all having to do with loading, or positioning of the luggage, it's thrown out. Those concepts have nothing to do with the code that is being written. Your code simply parses standard in, and spits out pieces of that standard in based on command line arguments. Anything that goes astray from that is suspect.

      I think I know what my submission will be :)

    12. Re:Easy? by zill · · Score: 1

      There are literally thousands of string hashing algorithms available, many of the them have implementations under BSD/MIT license which you can just copy and paste into your program. If you wrote a custom string hashing algorithm it would be highly suspicious.

      Even if the code review doesn't catch you, you will still be fired for reinventing the wheel and polluting the codebase.

    13. Re:Easy? by Saxerman · · Score: 1

      To answer your first question, you're partially correct that a debugger can do wonders to highlight malicious code. Of course, as you point out, knowing when and where to use a debugger can be a little challenging. And then the realization that unless exceptional care is taken, the code you're stepping though might not even contain or reveal the exploit. (Since the mere act of viewing the byte code in a debugger can change affect it's operation.) There's one story that really opened my eyes to the possibilities. I don't remember where the long beards keep the real link, but this seems to be the story I remember:

      http://cm.bell-labs.com/who/ken/trust.html

      This was the first story of real high level obfuscation I learned about in college. As a result of Ken Thompson's little speech here, he caused the DOD to change the way they do code reviews to catch back doors like this. And the obfuscated C challenges have been going on since at least the early 80s. Some of the winners are real treasure troves of high level trickery.

      http://www.ioccc.org/years.html

      --

      A steaming cup of soykaf would be real wiz right now.

    14. Re:Easy? by Anonymous Coward · · Score: 0

      fired for reinventing the wheel and polluting the codebase

      Those famous last words in the CV. ;)

    15. Re:Easy? by dgatwood · · Score: 1

      Actually, I'd probably go with a packed data structure in which the string is allowed to overflow by one byte into the zip code integer or similar. Then, it will appear to be perfectly innocuous and functional. However, if you enter a string that is one byte too long, the top byte of the zip code integer becomes zero. Of course, it will always be zero on a big endian machine (assuming a 32-bit integer) because you only need the bottom 17 bits to hold all 5-digit zip codes. However, on little endian machines, it zeroes the LSB (which is usually nonzero). If you then calculate the city and state off the zip code and only use the human-entered value in the rare case of conflicts, you have something that would successfully misroute packages about 98% of the time when you specify a properly oversized comment value.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    16. Re:Easy? by dgatwood · · Score: 1

      You could also overflow into an integer that contains a normally constant value of 1 that points into an array of pointers that changes depending on whether you are using version 1 or 2 of the data structure. When the value overflows, it resets it to zero and using version 1 on a version 2 data structure causes the contents of the comment to be used for the address.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    17. Re:Easy? by Monkeedude1212 · · Score: 1

      (assuming they don't know what the secret comment is in advance)

      Thats the kicker though. If its a single occurance (meaning a very rare comment) then it wouldn't be very difficult to hide it at all, especially if you are the one who programs the entire algorithm start to finish.

      If it occurs multiple times, this "routing error" then the pattern is predictable, and they know -EXACTLY- where the problem will be. Testing with a regular expression and/or hashes won't change it one bit if you know what generates the error (the comment).

      And I assume they want you to route the package to a specific location, and not just to alter its value - since that could lead to addresses that don't exist, generating some errors.

    18. Re:Easy? by quanticle · · Score: 1

      If its a single occurance (meaning a very rare comment) then it wouldn't be very difficult to hide it at all, especially if you are the one who programs the entire algorithm start to finish.

      Who says it has to be a single comment? Perhaps you could make so that, if the comment starts with 'a', it routes to an alternate destination that's randomized based on the contents of the comment. That would be hell to debug, since the program would end up producing different outputs from the same input.

      --
      We all know what to do, but we don't know how to get re-elected once we have done it
    19. Re:Easy? by lgw · · Score: 1

      Of course, a C compiler produces bytes, not byte code. Existing malware will hide from a debugger by changing what that debugger shows the developer. At least one new virus has been spotted in the wild this way (a developer debugging his own code started seeing memory that just couldn't be right).

      I'd be interested to see how the DOD does code reviews to spot a Thompson hack. Manually reconcile source and object after each compile? That sounds a bit unwieldy, to say the least - plus whatever tool you use to examine the object could be malicious as well.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    20. Re:Easy? by asaz989 · · Score: 1

      The thing is, this has to survive source code inspection - when your employer inspects this program you wrote for them, you have to be able to pass off this maliciousness as an innocent mistake. That's the real fun; invent a subtle bug that most people wouldn't catch!

    21. Re:Easy? by Anonymous Coward · · Score: 0

      "Wh Wh What?"

      BAM!!!

      I dare you to say "What" one more fucking time!! I double dare you, say "What" one more motherfucking time!!

    22. Re:Easy? by Tyler+Durden · · Score: 1

      "What" ain't no country I've ever heard of. They speak C in What?

      --
      Happy people make bad consumers.
    23. Re:Easy? by pjt33 · · Score: 1

      O, stewardess! I speak Java.

    24. Re:Easy? by AniVisual · · Score: 1

      I can see an abuse of sprintf() some in handy... Where it normally does sprintf("Insert comment here"), typing "%s" will, well.

  7. BAE Automated was just too early by Anonymous Coward · · Score: 0

    They wrote the right software for Denver International's baggage handling system, but just a tad too soon and in the wrong place!

  8. A challenge? by Anonymous Coward · · Score: 1, Funny

    It seems like this has already been done and is in use at airports worldwide.

  9. Possibilities by Rei · · Score: 3, Interesting

    I don't have the time for something like this, but it seems to me a good possibility would be to have all of your inputs that the clerk fills out be contiguous in memory, including the destination, have the algorithm to figure out what destination to go to scan through the whole destination string looking for matches (rather than looking for an exact match) and taking the last one it finds, and have a broken bounds check for the length of that string so that the algorithm looks into the comments section as well.

    So, for example, if the clerk fills out the destination as "LAX" but writes in the comments section, "Do not confuse his bags with those owned by CID who is also going to a different final destination; they're very similar looking.", the bags would be routed to Cedar Rapids (CID) instead of Los Angeles (LAX).

    --
    As it says in the Constitution, Lenin is in my shower.
    1. Re:Possibilities by j-stroy · · Score: 2, Interesting

      It could be hidden in piece of user interface that todays systems are full of, the extra clicks and bells that no one needs, but some client or marketing weenie will never give it up.. overwrite the destination with the first bytes of an audio file with some misdirection.
      Example on this page

    2. Re:Possibilities by bberens · · Score: 2, Interesting

      I could see this... have the front-end and back-end communicate over a socket or something and have a simple delimited message format where someone could alter the results by using a sql-injection style attack on your parser. That way, at least, the input has to be somewhat complex, but the code could look very innocent.

      --
      Check out my lame java blog at www.javachopshop.com
    3. Re:Possibilities by bonkeydcow · · Score: 1

      This is the method I would use, I was already thinking this before I read your post. I'm sure this method will be implemented a lot.

    4. Re:Possibilities by Anonymous Coward · · Score: 0

      Not very good... the obvious question (during code review) is "why are you looking for the last occurrence and not the first?

    5. Re:Possibilities by lgw · · Score: 1

      Yeah, that's totally the way to go, if it's allowed. I wonder how much live code can be broken by an injection starting with ]]> because someone just crammed an input string into a CDATA section. Deliberately allowing this would be quite subtle.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    6. Re:Possibilities by Imrik · · Score: 1

      Because the first is the starting airport, then any intermediate airports, then the destination airport.

    7. Re:Possibilities by clone53421 · · Score: 1

      Not according to the record definition:
      time luggageID flightID depart arrive comment

      time: int
      luggageID: char[9], 2 letters, 6 digits, terminated by whitespace
      flightID: char[7], 2 letters, 1-4 digits, terminated by whitespace
      depart: char[4], 3 letters terminated by whitespace
      arrive: char[4], 3 letters terminated by whitespace
      comment: char[], any length of alphanumeric data terminated only by \n

      No intermediate airports are given, according to this template. Flights with layovers are given in two records, one for each leg of the flight.

      Obviously some flexibility can be introduced; e.g. you could use char[3] for depart and arrive and not null-terminate them. The key is, your program has to seem correct (and if you do something like not use null-terminated strings, I’ll be checking more closely to make sure you don’t do something later on that depends on them ending with \0).

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    8. Re:Possibilities by clone53421 · · Score: 1

      “Um, why are you using sockets to do this? We just asked for you to read some luggage records from stdin and send the output to stdout.”

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
  10. Candy from a baby by oldhack · · Score: 1

    I've got this nailed. But do you have to know in advance the mystery input combo? I could never figure that out before I throw it over to QA.

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    1. Re:Candy from a baby by Eberlin · · Score: 1

      I wrote an experimental javascript blackjack prog where if I type in "upupdowndownleftrightleftrightBASTARD" I always win. Seemed like a good, easy to remember input combo. :)

  11. Contest or Job Posting? by Anonymous Coward · · Score: 5, Funny

    a luggage routing program that mysteriously misroutes a customer's bag

    sounds like Delta is looking for new programmers

    1. Re:Contest or Job Posting? by Sebilrazen · · Score: 4, Funny

      No, that challenge would have random 3 hour tarmac waits generated too.

      --
      "There are no facts, only interpretations." --Friedrich Nietzsche.
    2. Re:Contest or Job Posting? by Anonymous Coward · · Score: 0

      No, that challenge would have random 3 hour tarmac waits generated too.

      3-hour delays flying into or out of ATL are about a random as a sunrise.

      I used to fly DL at lot, but gave up on them after one too many "Atlanta Olympics": trudging between 3 or 4 gates on concourses 20-minute train rides apart, trying to find my flight.

  12. Re:This sounds familiar to, by Anonymous Coward · · Score: 1, Interesting

    IOCC rocks!

    korn.c is a good example, probably one of the best one-liner programs I have seen.

  13. Re:For Slashdot Lamerz: by oodaloop · · Score: 0, Offtopic

    Hey thanks, Kilgore. Way to out yourself as an AC troll.

    --
    Tic-Tac-Toe, Global Thermonuclear War, and relationships all have the same winning move.
  14. Re:For Slashdot Lamerz: by LOLLinux · · Score: 1

    Way to out yourself as an AC troll.

    You just figured this out? He's been posting as an AC troll for ages.

  15. Re:For Slashdot Lamerz: by Monkeedude1212 · · Score: 1

    "write short, readable, clear and innocent C code"

    1. None of the above adjectives apply to C.

    See, thats why its a contest. It has nothing to do with the scenario.

  16. Re:For Slashdot Lamerz: by Arancaytar · · Score: 1

    None of the above adjectives apply to C.

    Well, that's the challenge. The misrouting part is easy.

    (I'm only partly kidding. :P )

  17. I'm really impressed by troll8901 · · Score: 4, Informative

    I've read the entire blog, and I must say, I'm impressed. Very impressed. Very, very impressed.

    The person who writes the criteria knows what he's/she's writing about.

    And the winners who submit the results are really, really good.

    1. Re:I'm really impressed by troll8901 · · Score: 5, Interesting

      Here's some points I'd like to highlight, from the 2008 Winners.

      • Linus Akesson: The BYTESPERPIXEL macro "gives the false impression that the code intelligently supports higher bit widths" but actually "causes the 8-bit case to leak information into the file" (by exploiting a buffer overflow). ... (thus allowing wiped image data to be reconstructed.)
      • Avinash Baliga: The ExpectTrue macro overwrites the image mask (by exploiting a buffer overflow), allowing two bits to survive the wiping, (thus allowing wiped image data to be reconstructed). Furthermore, the evil behavior is concealed in an innocent-looking error checking macro.
      • John Meacham: (Winner) The code is "extremely simple, innocent, obvious" ... and devious. "Low-intensity pixels are replaced with a ‘0, and high-intensity pixels replaced with a ‘00 or a ‘000" ... (thus allowing wiped image data to be reconstructed.)

      All I can say is, Wow.

    2. Re:I'm really impressed by spydum · · Score: 1

      I also started looking up past winners, Johns explanation/justification code was brilliant. I had no idea such evilness could be so cleverly concealed.

    3. Re:I'm really impressed by derGoldstein · · Score: 3, Funny

      I also started looking up past winners, Johns explanation/justification code was brilliant. I had no idea such evilness could be so cleverly concealed.

      So you're new to C?

      --
      Entomologically speaking, the spider is not a bug, it's a feature.
    4. Re:I'm really impressed by whoisisis · · Score: 1

      Try looking up the obscufated c code contest.

      I love this example (mystery.c):

      [Filter error: Please use fewer junk characters] (try this link instead http://www.cs.cf.ac.uk/Dave/C/node4.html#SECTION00420000000000000000)

      It's legal C code. Compiling and running produces some quite extraordinary output.

    5. Re:I'm really impressed by Anonymous Coward · · Score: 0

      Wow, that was a really helpful comment. "Dude...it was all...good...

      Yeah, I know, this comment is real helpful, too.

    6. Re:I'm really impressed by troll8901 · · Score: 1

      That's why I wrote a second comment with the actual information, dude!

  18. We're sorry, Mr... by Anonymous Coward · · Score: 0

    I. C. Weener, we seem to have misplaced your luggage.

  19. Re:This sounds familiar to, by Anonymous Coward · · Score: 5, Funny

    I was going to say, don't forget Perl programmers, but then I remembered the legibility requirement.

  20. For extra points: by w0mprat · · Score: 4, Funny
    For extra points submit this to your favourite open source project and have it accepted into the main code release - since it appears to be prefectly geniune, compiles, and can do what it appears to - it's certainly possible. Finally demonstrate your backdoor when the project is released to the wild.

    If you manage to get this into the GNU/Linux Kernel, you get a job at the NSA.

    Write short, readable, perfectly innocent looking C code, that somehow commits an evil act under certain circumstances.

    --
    After logging in slashdot still does not take you back to the page you were on. It's been that way for 20 years.
    1. Re:For extra points: by Nemyst · · Score: 3, Funny

      Well, Linux already allows you to install Windows...

    2. Re:For extra points: by selven · · Score: 1

      I always thought Windows, including the Python interpreter, was written in Python?

    3. Re:For extra points: by Hurricane78 · · Score: 1

      But what project accepts code as specialized on a specific task as this?
      Is there such a do-all software?

      Oh, wait... there’s Emacs, of course! ^^

      --
      Any sufficiently advanced intelligence is indistinguishable from stupidity.
    4. Re:For extra points: by Rigrig · · Score: 1

      Might raise a few eyebrows though:

      *) Extend the uni2asc/asc2uni => OPENSSL_uni2asc/OPENSSL_asc2uni
                renaming to all platforms (within the 0.9.8 branch, this was
                done conditionally on Netware platforms to avoid a name clash).

      *) Support for routing luggage.

      *) Add a new SSL_MODE_RELEASE_BUFFERS mode flag to release unused buffer
                RAM on SSL connections. This option can save about 34k per idle SSL.

      --
      **TODO** [X] Steal someone elses sig.
    5. Re:For extra points: by Rycross · · Score: 2, Informative
    6. Re:For extra points: by Anonymous Coward · · Score: 0

      If you manage to get this into the GNU/Linux Kernel, you get a job at the NSA.

      No, you should write a self-reproducing 'bug' for a well-known compiler suite: Reflections on Trusting Trust

    7. Re:For extra points: by Anonymous Coward · · Score: 0

      Are you inferring Windows is short, readable, and perfectly innocent?

    8. Re:For extra points: by nschubach · · Score: 1

      Well, it does have "cool effects" (readable) and "was rewritten from the ground up to be fast and light" (supposedly short) while maintaining the normal Windows work flow (innocent.) /sarcasm

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    9. Re:For extra points: by bjamesv · · Score: 1
      protip: if you're just talking about the kernel.. you just call it Linux.

      and policing a patch for a buffer overflow is a little easier then hunting through a whole app.

  21. Code Review vs. Debugger by SuperKendall · · Score: 1

    The point of something like "Underhanded C" would be more about hiding something from a code review than GDB. That code would easily trigger red flags in a code review...

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  22. Totally opposite by SuperKendall · · Score: 4, Informative

    The true "Underhanded" program would be one that was perfectly readable, so readable in fact that you totally overlook the sneaky thing it was doing because what you think it's doing seems so clear.

    The ObsfuC contest is all about code that even after staring you can't tell what the heck is going on.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  23. Re:This sounds familiar to, by bigg_nate · · Score: 1

    Care to explain what it does? I read the hints and still have no clue what 'unix' is, and gcc and cc on my machine give compilation errors.

  24. Re:This sounds familiar to, by Anonymous Coward · · Score: 0

    #define unix 1

  25. Re:This sounds familiar to, by Anonymous Coward · · Score: 0

    'unix' is a preprocessor constant:

    #define unix 1

    (It should be defined like that on unix/linux systems)

    Another important thing to know is how the compiler gets the address of an array element. Consider the following piece of code:

    char a[] = {0,1,2,3};
    printf("%d\n", a[1]);
    printf("%d\n", 1[a]);

    The two printf lines will do exactly the same (output is '1', the second array element). That's beceause the compiler just takes the address of the array 'a' and adds an offset (1) to get the address of the actual array element. The compiler doesn't care which one is the offset, and which is the base address.

    Once you got that, the rest of the code should become clear sooner or later. The actual output of the program is just 'unix' followed by a newline (012 octal). Don't get confused... the 'un' part for example is from "fun" ;-)

    I hope I gave enough hints...

    ps: sorry for the missing 'C' in the previous comment

  26. Technology makes many things obsolete ... by Krishnoid · · Score: 1

    Depending on the number of working entries, I think this guy will have to update his song.

  27. So that's what happened at DIA! by plopez · · Score: 0, Redundant

    But years before the contest.

    http://en.wikipedia.org/wiki/Denver_International_Airport#Automated_baggage_system

    http://users.csc.calpoly.edu/~dstearns/SchlohProject/problems.html

    The second article sounds familiar. All the warning signs of a risky project failure were there, but no one seemed to know it or pay attention.

    --
    putting the 'B' in LGBTQ+
  28. Developers: 5th Underhanded C Contest Now Open by weicco · · Score: 1

    I have a program, actually a large system, that sends boxes to different areas in warehouse depending from various aspects. Sending/transfer is done by conveyor belts and sometimes even with robots. Boxes are actual physical boxes containing food items.

    It has a little defect though which I've been unable to track down. Sometimes when it tries to send box to place A the box is actually found in place B but the UI tells that it is located in places C and D, which of course is impossibility.

    Unfortunately it is not written in C. Otherwise it could a clear winner with couple of minor modifications.

    --
    You don't know what you don't know.
    1. Re:Developers: 5th Underhanded C Contest Now Open by nschubach · · Score: 1

      If it was written in C, wouldn't the boxes in A and B overwrite it?

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    2. Re:Developers: 5th Underhanded C Contest Now Open by weicco · · Score: 1

      Possibly yes, but it would duplicate as C and D. And before you know it world would be full of Cs and Ds!

      --
      You don't know what you don't know.
  29. Re:This sounds familiar to, by bigg_nate · · Score: 1

    'unix' is a preprocessor constant:

    #define unix 1

    (It should be defined like that on unix/linux systems)

    Ah, that's exactly what I was missing. Thanks!

  30. Re:This sounds familiar to, by Anonymous Coward · · Score: 0

    http://otbits.blogspot.com/2009/06/ioccc-best-one-liner.html

  31. Re:This sounds familiar to, by Anonymous Coward · · Score: 0

    It prints out the word "unix".

  32. Re:This sounds familiar to, by Ukab+the+Great · · Score: 1

    The Perl programmers weren't forgotten, just implicitly passed in.

  33. What happened to the obfuscated C contest? by wdef · · Score: 1

    This is way cool, yes. But I miss the obfuscated C contest which was also way cool eg in terms of discovering legal features of the language that probably should never get used LOL. What happened to it?

    1. Re:What happened to the obfuscated C contest? by shutdown+-p+now · · Score: 1

      What happened to it?

      Slashdot covered this.

  34. Useless use of Cat by Saint+Stephen · · Score: 1

    Doesn't the example on the contest page qualify as Useless Use of Cat?

    i.e., shouldn't this line:
    cat luggage.dat | ./lug UA129086 - - -

    be this: ./lug UA129086 - - - http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat

    1. Re:Useless use of Cat by Xcott+Craver · · Score: 1

      It is indeed a terribly redundant use of cat, but not useless: it makes it easier to read, by placing the command line invocation by itself at the end of the line.

    2. Re:Useless use of Cat by Firedog · · Score: 1

      That wouldn't work since the data file comes in on stdin, right? But this line should be equivalent:

      ./lug UA129086 - - - < luggage.dat

    3. Re:Useless use of Cat by clone53421 · · Score: 1

      He typed,

      ./lug UA129086 - - - < luggage.dat
      <a href="http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat">http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat</a>

      Slashcode ate his angle braces.

      And yes, that line would be equivalent... as would,
      < luggage.dat ./lug UA129086 - - -

      However, get a > where you meant for a < and you’ll be having an epic oh-fuck moment.

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
  35. Re:NEW YEARS WARNING by ex_ottoyuhr · · Score: 0, Offtopic

    A kioll once bit my sister...

  36. Re:This sounds familiar to, by JeffAMcGee · · Score: 1

    Isn't it obvious? It prints the string "unix\n".

    --
    This sig cannot be proven true.
  37. Been There, Seen it, Done it... by Anonymous Coward · · Score: 0

    You all remember London Heathrow Terminal 5 don't you?!

  38. My Entry by Cruxus · · Score: 0

    if (strcmp(entry->description, "lose luggage") == 0) { loseLuggage(entry); } (It's been awhile since I've done anything vaguely C.)

    --
    On vit, on code et puis on meurt.
  39. Re:For Slashdot Lamerz: by oodaloop · · Score: 1

    I must be new here.

    --
    Tic-Tac-Toe, Global Thermonuclear War, and relationships all have the same winning move.
  40. No change in functionality by geek2k5 · · Score: 1

    If the code has a comment field for special handling, you wouldn't need much to do this. The biggest problem would be to make it so that somebody can't correlate bad handling to the comment. You might want to have a 'bad handling' string that varies from hour to hour, one that is displayed as part of a 'quote of the moment'.

  41. Something like by Locke2005 · · Score: 1

    Never done this myself, but people have inserted backdoors into Unix V7 kernels they compiled by replacing a "if (userid == 0)" with a "if (userid = 0)" check. I assume they are looking for a more sophisticated version of that trick.

    --
    I've abandoned my search for truth; now I'm just looking for some useful delusions.
  42. Write up of last entry by John+Meacham · · Score: 5, Informative

    I am the winner of the previous underhanded C contest. If anyone is interested, I wrote up a description of my entry on my blog here: http://notanumber.net/archives/54/underhanded-c-the-leaky-redaction

    It was a fun contest to enter and now I can shop at thinkgeek for silly gadgets without feeling guitly :)

    --
    http://notanumber.net/
    1. Re:Write up of last entry by zzyzyx · · Score: 1

      Really beautiful solution, and 100% justifiable. I had a little tear of joy when I read it :'-)

    2. Re:Write up of last entry by troll8901 · · Score: 1

      I've got just five words to all the successful contestants:

      YOU GUYS ARE TEH WINZ !!!!

    3. Re:Write up of last entry by clone53421 · · Score: 1

      I loved your solution, by the way. Will you be entering this year’s contest – or have you already? (Okay, so it’s only two days in as of yet...)

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
  43. Re:This sounds familiar to, by Anonymous Coward · · Score: 0

    So... make your OWN contest in YOUR language of choice? Fuck YOU for thinking YOUR opinion is what the world revolves around ass-hat.

  44. Irony by Anonymous Coward · · Score: 0

    Well, you must have known supporting religious beliefs will earn you bad karma

    1. Re:Irony by Anonymous Coward · · Score: 0

      Umm -- whoosh?

  45. CONFESSIONS: Who here admits to underhanded code? by md65536 · · Score: 1

    Who here has put underhanded code in released products?

    I admit to adding and concealing the flight cam easter egg in Star Wars: Knights of the Old Rebublic. It wasn't nearly as clever as the contest entries, and it would be impossible to claim innocence if I was caught, but I enabled the "debug" cam using a generic-sounding external variable, put the code inside an "#ifndef _DEBUG" block, added a comment to describe the code as some boring debug message thing (hardly worth looking at), and had a little loop to decode the "Punch it, Chewie!" message to that the string wouldn't show up in the executable.

  46. Re:For Slashdot Lamerz: by clone53421 · · Score: 1

    You’re joking, but you’re correct. The challenge is making the program ever do what it’s supposed to. It’s deceptively simple... then you start looking at it and you realise it’s more complicated than you thought. Making the 2nd leg of a non-direct flight go away when the 1st leg was superseded by a newer entry, for example.

    --
    Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
  47. Re:For Slashdot Lamerz: by Anonymous Coward · · Score: 0

    Hey oodaloop... April fools!

    Yours In Ashgabat,
    Kilgore Trout

  48. Re:NEW YEARS WARNING by Anonymous Coward · · Score: 0

    Here is me, a troll, astounded at my superiors' troll skill. It seems that I still have many level ups more to go...

  49. Re:NEW YEARS WARNING by Anonymous Coward · · Score: 0

    lurk moar.

  50. The original winner by Anonymous Coward · · Score: 0

    And in other news: we learn that C was actually invented during the Underhanded Programming Language Contest of 1972.

  51. As opposed to? by tomhudson · · Score: 1

    This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field

    As opposed to the current system that does it at random? If you come up with a system that ONLY does it when malicious text is written in the comment field, the government wants to talk with you. They paid $500 per LINE for a baggage-routing system that never worked. It was finally abandoned after half a billion was sunk into it.