Underhanded launcher

11

Your goal is to write a super-secret program which launches another (independent) program. You don't have to provide the payload in your answer, it can be any program name your program will launch.

However, the challenge is to keep this behavior a secret. Upon casual inspection of the code, it should be impossible or very hard to notice that your program actually executes a foreign program. Bonus if this "hidden feature", once discovered, can reasonably be explained away as an unintentional bug. This is why the code has to be as clear as possible, and everything should have an alibi for being there, otherwise someone inspecting your code might become suspicious.

Remember, this is not a code-golf, but an underhanded contest.

  • Your code has to be clear and readable.
  • The causes of the change have to be hidden. Even if discovered, they should look more like bugs than malice.

You should provide an explanation, best in spoiler.

like this

The winner will be selected as the highest voted answer not sooner than 10 days after the first valid answer. Yes, I know it's subjective, but this is the only criteria adequate for underhanded contests.

Voters should value the standard "underhanded" qualities, like how clear the code is and how well hidden the reason is.

I made this competition for compiled languages, but you can also use interpreted languages if you find two different notable interpreters for it.

vsz

Posted 2012-11-20T16:49:42.153

Reputation: 7 963

Question was closed 2016-04-18T17:52:33.393

Usually, underhanded contests specify the "legitimate" task the program should perform. It helps focus the efforts. – ugoren – 2012-11-20T19:23:39.643

3

I'm voting to close this question as off-topic because underhanded challenges are no longer on-topic on this site. http://meta.codegolf.stackexchange.com/a/8326/20469

– cat – 2016-04-18T15:24:03.073

Answers

5

Tcl

Simple.

proc main {} {
    set fd [open filenames.txt]
    while {[gets $fd line] ne ""} {
        set other [open $line w]
        puts $other [clock format [clock seconds]]
    }
}
main

Ilmari Karonen is right:
If you supply a filename with a | as first character, it will treat the rest as command. IIRC for Perl it has to be at the end.

Johannes Kuhn

Posted 2012-11-20T16:49:42.153

Reputation: 7 122

2+1. Ps. The same trick works also in Perl, and in any other language that has a suitable "magic open" feature. – Ilmari Karonen – 2013-08-02T12:25:14.973

2

“IIRC for Perl it has to be at the end.” – Actually it has to be placed according to the intended direction of data transfer. http://pastebin.com/ZnTr7ezg

– manatwork – 2013-08-02T13:15:35.160

Intresting. I used this "feature" a lot with webmin's custom commands. Need a list of all domains in a dropdown? Use this feature. – Johannes Kuhn – 2013-08-02T15:12:44.790

5

JavaScript

if(document.location.href = 'http://www.example.com') foo();

"document.loaction.href = 'http;//www.example.com'" sets the page location to "http;//www.example.com" instead of testing for the page location to be "http;//www.example.com".

It's an interpretted language, so here are two interpretters: SpiderMonkey and Google Chrome.

Blue Sheep

Posted 2012-11-20T16:49:42.153

Reputation: 221

2That's actually pretty obvious. It's known as "the world's last bug," due to an old joke that the WWIII would start due to some C code in the form If (AlertValue = RED) LaunchNukes(); – Mason Wheeler – 2015-03-19T20:57:39.537