Comment On Classic WTF: The Phantom of The System

It's a particularly busy week for me: on top of a few looming deadlines, I'll be at Business of Software 2008 in Boston. So, I figured it'd be the perfect opportunity to revisit some classics. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Classic WTF: The Phantom of The System

2008-09-03 08:02 • by ParkinT
' this will be used as a dummy, to throw off the wise
' it is a post about nothing

Re: Classic WTF: The Phantom of The System

2008-09-03 08:12 • by bitblit
At work it sang to me
In code it came
22, 7, minus 12
And 620
But do I scream again?
For now I see
The Phaaaaantom of The System Whiz is here
Inside ThankYou.asp

Re: Classic WTF: The Phantom of The System

2008-09-03 08:16 • by zw (unregistered)
Man 1: Hurry, type in 4 8 15 16 23 42!

Man 2: Aaaaaaarrrgghhhhh! NO, it's 22, 7, -12, and 620, you moron!

Re: Classic WTF: The Phantom of The System

2008-09-03 08:16 • by R (unregistered)
I'm having trouble deciding between my dummy response of

hahahhahahahahahahahhahaha

and my real response - a long drawn out pained wail, just like the poor phantom of the opera.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:23 • by Carlos92 (unregistered)
It's sort of obvious that the author is trying to obtain "security by oscurity" instead of using an encryption algorithm with a key that the server keeps in memory or disk.

The "secrets" are the size of the left and right masks that one has to remove, and the coefficients of a linear equation that one has to solve.

Not actually obfuscated (as in Perl) but bloated...

Re: Classic WTF: The Phantom of The System

2008-09-03 08:26 • by Carlos92 (unregistered)
215482 in reply to 215481
I almost forgot to mention the ludicrous comments and the ugly variable names that don't convey information.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:27 • by akatherder
The encoding/encrypting/obfuscating is bad enough, but it's a programming sin to pass a total in the querystring.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:36 • by Dante Gates (unregistered)
Just like the 7 layers of hell, there are 7 layers of stupidity:

1. Ignorance is bliss.

2. Yes, I'm ignorant, but I think I'll write some code anyway.

3. I'm ignorant, but I think I'll write some code FOR A WEB SITE, where the whole world can mess with me 7 by 24.

4. I'm ignorant, but I think I'll write some web code that handles REAL MONEY.

5. I'm writing a web page that handles money, but I've never heard of hackers.

6. I know hackers are tricky and evil, but I didn't think they'd stoop so low as to pick up the money I left lying around in my site.

7. I am fully informed about hackers and how they will try to alter the price, but instead of keeping it where they can't touch it, I'll send it to them anyway using my super-secret, incomprehensible technology, ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:40 • by a pedant (unregistered)
215485 in reply to 215483
akatherder:
The encoding/encrypting/obfuscating is bad enough, but it's a programming sin to pass a total in the querystring.


It's perfectly fine to pass it in the querystring.

Providing you also keep it on the server and use the server for all calculations, processing, verification.

Putting it in the querystring or cookie means you could have a cached static page use JavaScript to display the shopping cart details and total. This means that if you have a 100% commerce website you could make little JavaScript libs to show the cart everywhere without having to make the entire site dynamic. Further, if you have 3rd party partner sites, you could use JavaScript to still show the cart on those sites without giving them access to your pages.

Seems fine to me.

Providing you work with the server values and only use the querystring, cookie, etc for presentation.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:48 • by morry
My power over you grows stronger yet ...
And though you turn from me, to glance behind,
the Phantom of the System is there - INSIDE your mind ...

Re: Classic WTF: The Phantom of The System

2008-09-03 08:53 • by Gorfblot (unregistered)
215488 in reply to 215485
a pedant:

Providing you work with the server values and only use the querystring, cookie, etc for presentation.


Nobody could possibly be stupid enough to rely on the client to tell you how much to charge.

(I was almost able to type that with a straight face...)

Re: Classic WTF: The Phantom of The System

2008-09-03 08:53 • by akatherder
215489 in reply to 215485
a pedant:
Providing you work with the server values and only use the querystring, cookie, etc for presentation.


That seems silly. You have access to the server values and you're using those for calculation on the back-end. Just present the real values to the customer.

I guess you could get away with presenting the real values on a final "confirmation" page and let the user play with cookies/querystring during checkout. But you're on the hook if the page says "Do you agree to let us charge your credit card $1.00 for your Xbox 360?".

Re: Classic WTF: The Phantom of The System

2008-09-03 08:54 • by Zecc
215490 in reply to 215484
We really need to come up with a better generation of goggles.

Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...in comments that aren't sent to the client browser.

Re: Classic WTF: The Phantom of The System

2008-09-03 08:57 • by Dante Gates (unregistered)
215492 in reply to 215490
Zecc:
Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...which isn't sent to the client browser.

Then how does the browser decode and display the true price on the thank you page?

Re: Classic WTF: The Phantom of The System

2008-09-03 09:00 • by ThisIsMe (unregistered)
"Masquerade"
;)

Re: Classic WTF: The Phantom of The System

2008-09-03 09:05 • by real_aardvark
This pretty much reminds me of those numerical games that we used to play as little kids -- you know, "Think of a number, then multiply it by your birth date and subtract two" type games. The only substantive difference is that this guy doesn't seem to be able to perform the actual arithmetic.

Still, it's possibly nice to know that one of my more idiotic friends from fifth grade is out there performing a valuable service for society.

Re: Classic WTF: The Phantom of The System

2008-09-03 09:13 • by NeoMojo (unregistered)
215495 in reply to 215492
Dante Gates:
Zecc:
Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...which isn't sent to the client browser.

Then how does the browser decode and display the true price on the thank you page?


in the server side script of the thank you page. It doesn't need to have the calculation in the client side script.

Re: Classic WTF: The Phantom of The System

2008-09-03 09:21 • by Steve (unregistered)
215498 in reply to 215477
bitblit:
At work it sang to me
In code it came
22, 7, minus 12
And 620
But do I scream again?
For now I see
The Phaaaaantom of The System Whiz is here
Inside ThankYou.asp
Bravo! Take a bow.

I laughed. . .

. . . and I can't stand Phantom of the Opera.

Re: Classic WTF: The Phantom of The System

2008-09-03 09:26 • by MadJo@Work (unregistered)
215500 in reply to 215492
Dante Gates:
Zecc:
Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...which isn't sent to the client browser.

Then how does the browser decode and display the true price on the thank you page?

ASP comments won't get shown in the sourcecode viewer in your browser. In fact no ASP code gets shown there.

Re: Classic WTF: The Phantom of The System

2008-09-03 09:27 • by robd (unregistered)
first!

Re: Classic WTF: The Phantom of The System

2008-09-03 09:46 • by JimM
215502 in reply to 215483
akatherder:
The encoding/encrypting/obfuscating is bad enough, but it's a programming sin to pass a total in the querystring.

At least it wasn't sent as the total though: it was sent as the tracking code. And NO-ONE would think of playing with the tracking could (would they?). What I find odd is that he went to all that trouble to mess with the actual total, but didn't think to multiply it by 100 first to get rid of the decimal places...

Re: Classic WTF: The Phantom of The System

2008-09-03 09:47 • by jkupski (unregistered)
215503 in reply to 215477
bitblit:
At work it sang to me
In code it came
22, 7, minus 12
And 620
But do I scream again?
For now I see
The Phaaaaantom of The System Whiz is here
Inside ThankYou.asp


Think of this, think of this bad code
When you write your scripts
Remember this: never write code while on an acid trip

We told you that your code was horrible
But to this you were quite deaf
So now you see your name on
The daily WTF!

Re: Classic WTF: The Phantom of The System

2008-09-03 09:54 • by Code Dependent
The code churning within The System was so intricate and complex that only "The Whiz" (who, consequently, was also the author of The System) could possibly understand and maintain it.
I doubt that being the author of The System was a consequence of being the only one who could understand it. The other way around, maybe. Perhaps you meant to say, "who, coincidentally, was also the author"?

Re: Classic WTF: The Phantom of The System

2008-09-03 10:12 • by Satanicpuppy
Fricking amateurs. If you can't do crypto, don't try, because you're only going to be making yourself look like a fool down the line. I consider myself pretty knowledgeable, and I wouldn't even dream of trying to roll my own, due to my lack of an advanced degree in mathematics.

The real WTF is that he thought he needed to obfuscate the fricking order total...If someone was monitoring your connection, and possessed a calculator, they could surely figure it out for themselves...even if you (radically) went to ssl when you started the checkout process.

Re: Classic WTF: The Phantom of The System

2008-09-03 10:17 • by Charles400
Phantom of the Opera - where it's okay to romanticize stalkers.

Re: Classic WTF: The Phantom of The System

2008-09-03 10:20 • by JoeyLemur (unregistered)
I wonder if HR would have words with me if I started referring to the admin across the aisle from me as Christine...

Re: Classic WTF: The Phantom of The System

2008-09-03 10:41 • by ObiWayneKenobi
Having dealt with systems similar to this, at least "The Whiz" used okay (not great) variable names. Try dealing with something similar to this that uses barely any indentation at all, dozens of include files per page, VBScript subroutines that take a reference to the object they work with and instantiate it instead of returning the thing, and variable names that seem to have been stripped of all vowels, and you'll long for the beautiful misery of "The System"

Re: Classic WTF: The Phantom of The System

2008-09-03 11:09 • by John (unregistered)
I was once tasked with maintaining an ASP/VBScript that allowed users to construct an order worth on average ~£30,000. It then had an editable field where they could overtype this value with whatever value they liked... When I tried it out, I typed in 0 (zero) and hit submit, fortunately it prevented me doing this.

Intrigued as to why this was editable, I delved a little deeper, to my horror it only prevented the user from typing in their own value if the input value caused the deal to give a negative profit (or loss!), so as long as you are not too greedy about the discount you wish to give yourself... you can have it at cost price. (A hefty 55% discount on average)

Re: Classic WTF: The Phantom of The System

2008-09-03 11:47 • by KenW
215519 in reply to 215504
Code Dependent:
I doubt that being the author of The System was a consequence of being the only one who could understand it. The other way around, maybe. Perhaps you meant to say, "who, coincidentally, was also the author"?


As this is a re-publication of something that appeared three years ago, perhaps the pedantry should be posted to the original post instead of here.

Re: Classic WTF: The Phantom of The System

2008-09-03 11:53 • by JDeepBeep
Lloyd WWWeber.

Ergh.

Re: Classic WTF: The Phantom of The System

2008-09-03 12:19 • by h (unregistered)
215522 in reply to 215519
KenW:
Code Dependent:
I doubt that being the author of The System was a consequence of being the only one who could understand it. The other way around, maybe. Perhaps you meant to say, "who, coincidentally, was also the author"?


As this is a re-publication of something that appeared three years ago, perhaps the pedantry should be posted to the original post instead of here.

Yes, but then the whole pedantic system falls apart, and this guys mean nothing to society anymore... oh wait.

Re: Classic WTF: The Phantom of The System

2008-09-03 13:11 • by Code Dependent
215528 in reply to 215519
KenW:
As this is a re-publication of something that appeared three years ago, perhaps the pedantry should be posted to the original post instead of here.
It's okay, Ken, I wasn't expecting it to be corrected. I just get a kick out of pointing it out. Plus, pedantry's so uniquely qualified to get a reaction check, isn't it.

Re: Classic WTF: The Phantom of The System

2008-09-03 13:17 • by Andrew (unregistered)
He was trying to obfuscate the url so hackers couldn't manipulate it. Looks good to me, i don't see the problem here.

Re: Classic WTF: The Phantom of The System

2008-09-03 13:52 • by TJ (unregistered)
wouldnt a form post have been easier?

I am all for security and "code poetry" but i am also an extremely lazy programmer, i would like it to work correctly with the minimum amount of effort from me or the system

Re: Classic WTF: The Phantom of The System

2008-09-03 14:50 • by Shill (unregistered)
215538 in reply to 215504
Code Dependent:
The code churning within The System was so intricate and complex that only "The Whiz" (who, consequently, was also the author of The System) could possibly understand and maintain it.
I doubt that being the author of The System was a consequence of being the only one who could understand it. The other way around, maybe. Perhaps you meant to say, "who, coincidentally, was also the author"?


I think the word everyone was looking for was necessarily.

Re: Classic WTF: The Phantom of The System

2008-09-03 16:07 • by RH (unregistered)
215546 in reply to 215529
Andrew:
He was trying to obfuscate the url so hackers couldn't manipulate it. Looks good to me, i don't see the problem here.


BEFORE ANYONE ACTUALLY REPLIES TO THIS, CONSIDER THE VERY LIKELY POSSIBILITY IT'S A TROLL AND FEEDING TROLLS IS BAD BECAUSE IT BEGETS MORE TROLLS

Re: Classic WTF: The Phantom of The System

2008-09-03 16:33 • by North Bus
215549 in reply to 215503
jkupski:

Think of this, think of this bad code
When you write your scripts
Remember this: never write code while on an acid trip

We told you that your code was horrible
But to this you were quite deaf
So now you see your name on
The daily WTF!



I nominate this for a Tony.

Re: Classic WTF: The Phantom of The System

2008-09-03 17:03 • by Code Dependent
215551 in reply to 215538
Shill:
I think the word everyone was looking for was necessarily.
Not necessarily.*






*You set that up on purpose.

Re: Classic WTF: The Phantom of The System

2008-09-03 19:11 • by Anonymouse (unregistered)
215563 in reply to 215538
Er, it's pretty clear that the intended word was coincidentally.

"... The Whiz (who, coincidentally, was also the author of The System)..."

See, there's sarcasm in them thar hills.

Re: Classic WTF: The Phantom of The System

2008-09-03 20:25 • by Chris (unregistered)
215569 in reply to 215500
MadJo@Work:
Dante Gates:
Zecc:
Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...which isn't sent to the client browser.

Then how does the browser decode and display the true price on the thank you page?

ASP comments won't get shown in the sourcecode viewer in your browser. In fact no ASP code gets shown there.
I guess you forgot about (or are oblivious to) the multiple known vulnerabilities in ISS + ASP which cause the web server to dump the source of the file to the web browser, rather than interpret/execute it.

I won't go into detail, but I have used one of the known issues to break at least one system that ran on ISS with ASP.

Relying on the client to send you anything other than something that they NEED to send you is folly, indeed. All totals, etc should be tracked ON THE SERVER, never relying on the client to pass the right data (even if it is obfuscated), because you never know when your web server might spit out the source of your page and make it *very* easy for someone to figure out what sort of incantation to invoke to make your program theirs. :p

Re: Classic WTF: The Phantom of The System

2008-09-04 01:41 • by joemck
With not a single line containing anything even resembling a function or subroutine.

Sounds like we all know who "The Whiz" was. Spectate, are you listening?

Re: Classic WTF: The Phantom of The System

2008-09-04 04:58 • by Max Romantschuk (unregistered)
215587 in reply to 215494
I'm unfortunately also all too familiar with this approach. I've used a system which obfuscates all URLs to a ?foo=000013421 where foo is a number chosen more or less randomly and only valid for your session.

It's more secure like that, it seems... But it also makes every single support email rather useless, when no URL sent by anyone will work for anyone else... Some people seem to thrive on making things difficult for every one else.

Re: Classic WTF: The Phantom of The System

2008-09-04 05:37 • by nat42
maskerAmount = oTotal*4340 + 88040 //where oTotal is not huge, ie. less than about 500K

I love that he chose to multiply everything by 620!

As being divisible by 10 adds and obvious "0" digit for any would-be script kiddies to note strangle occuring in EVERY masked amount, and the numbers to the left hand side of this then always being even, well that's a huge clue as to the obfuscation method being used IMHO!

Re: Classic WTF: The Phantom of The System

2008-09-04 05:53 • by brazzy
215593 in reply to 215505
Satanicpuppy:
The real WTF is that he thought he needed to obfuscate the fricking order total...

No, the real WTF is what this need hints at: the order total is probably sent back to the server and used for billing, meaning that if someone defeats the Whiz's mighty crypto skillz and manipulates the HTTP request, they can make it so that they actually billed only $0.01 for any order.

Re: Classic WTF: The Phantom of The System

2008-09-04 11:03 • by An Old Hacker (unregistered)
215618 in reply to 215505
Satanicpuppy:
Fricking amateurs. If you can't do crypto, don't try, because you're only going to be making yourself look like a fool down the line. I consider myself pretty knowledgeable, and I wouldn't even dream of trying to roll my own, due to my lack of an advanced degree in mathematics.

The real WTF is that he thought he needed to obfuscate the fricking order total...If someone was monitoring your connection, and possessed a calculator, they could surely figure it out for themselves...even if you (radically) went to ssl when you started the checkout process.


Ummm... I _have_ an advanced degree in mathematics. And I don't dream of it either, because I majored in topology, not number theory. Seriously, people, stick with published, peer-reviewed methods. Go back every couple of years to see if you need to replace anything due to uncovered vulnerabilities. Same thing with getting cute with randomness. Use approved libraries, but only after you have read up on their characteristics and consider them to be acceptable.



Re: Classic WTF: The Phantom of The System

2008-09-04 12:27 • by Kevin (unregistered)
There are multiple WTFs in this story.

1.) The complete method here is wrong! OrderProcessing.foo should process the order (as the name implies), then display the thank you, that way this kind of obfuscation is unnecessary.

2.) If the total is 155.72, and you pad it on both sides with numbers, you will get a stupid total with tenths, hundreths, and thousandths of a cent! (2943155.7230843)

3.) We won't even go into the total irresponsible nature of this application - especially the fact that it was programmed in VBScript & ASP.

--Kevin

Re: Classic WTF: The Phantom of The System

2008-09-04 15:05 • by ClaudeSuck.de
TRWTF is that The Wiz makes such big efforts to hide the total amount of an order. What the heck is so secret about it?

Re: Classic WTF: The Phantom of The System

2008-09-04 15:12 • by ClaudeSuck.de
215748 in reply to 215500
MadJo@Work:
Dante Gates:
Zecc:
Dante Gates:
ALONG WITH THE INSTRUCTIONS TO DECODE THE PRICE in the script of the page.
...which isn't sent to the client browser.

Then how does the browser decode and display the true price on the thank you page?

ASP comments won't get shown in the sourcecode viewer in your browser. In fact no ASP code gets shown there.


No, not the code. But the order total should be shown at a certain point.

Re: Classic WTF: The Phantom of The System

2008-09-04 16:28 • by Blaufish (unregistered)
A certain system I debugged has similarly mysterious URL-altering-functions (although not as uggly as the implementation posted here).

I asked a skilled guy who still remembered The Days of Creation, and it was multi-purpose; main feature was to prevent caching (according to tests/rumors, none of the pragma variants worked very well in the old days when HTTP Proxies was new; user's got cached web page copies (including user specific data) from proxies. Until the invention of the URL randomizing was introduced, that is.

Legacy is horrible.

Re: Classic WTF: The Phantom of The System

2008-09-04 16:51 • by real_aardvark
215790 in reply to 215528
Code Dependent:
KenW:
As this is a re-publication of something that appeared three years ago, perhaps the pedantry should be posted to the original post instead of here.
It's okay, Ken, I wasn't expecting it to be corrected. I just get a kick out of pointing it out. Plus, pedantry's so uniquely qualified to get a reaction check, isn't it.
Well, as usual, KenW has correctly picked on a thoroughly miserable specimen of so-called humanity whose mental deficiencies are visible to anyone with a functional, yet thoroughly unimaginative, blog moniker. As usual, he has totally missed the point.

This Grammar Nazi thing you have about the use of "consequently," and the related implication of cause and effect: you have completely missed the point. Using my Code Smell ninja powers of analysis, this is clearly not an example of one-way cryptography: therefore the arrow of time does not apply. Since it is obviously impossible for anybody to be dense enough to write this "function" in the normal sense of time, the "function" must have existed before its author. Consequently we need to reverse the arrow of time -- I have this conclusion on the authority of no less a person than Sherlock Holmes -- and conclude that the code is, indeed, the cause of the author.

I hope you feel properly ashamed of yourself for not realising this. And I'm not going to stand for any "no shit, Sherlock" retorts, either.
« PrevPage 1 | Page 2Next »

Add Comment