Comment On Top-grade, SHA1 Encryption

Paul B always thought of himself as a moderately-paid consultant. With no real overhead, a policy against ties when meeting with prospective clients, and a general pickiness about the projects he'll take on, his rates tend to be pretty low. One company that looked right up his alley was a mid-sized manufacturing company that wanted a custom webshop. They went to the highly-paid consultants in town, but weren't too happy with the six-figure price tag. Paul's quote was in the five-figure range, which he felt was pretty moderate given that it was a several month project. Of course, the company wasn't too happy with his quote either, so they searched high and low for a three- or four-figure price. They eventually found one overseas. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Top-grade, SHA1 Encryption

2011-08-15 09:19 • by Marine
First! Sounds a blast - how on earth did this company even get a project if they are this bad? I'd hate to see the rest of the code!

Re: Top-grade, SHA1 Encryption

2011-08-15 09:23 • by GettinSadda
At least it will make SQL injection just a tiny bit harder as an extra bracket it required that the hacker would not expect.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:33 • by MiffTheFox
68a6a81ff9352dad1909c2907451fb726886328b

0323094163a8ecd15bf19efe081cf793ec345376

Re: Top-grade, SHA1 Encryption

2011-08-15 09:35 • by ted (unregistered)
Clearly the WTF is SHA1 encryption. This would've been far better:

$result = mysql_query(
"SELECT * FROM users " .
" WHERE SHA1(ROT13(username)) = SHA1(ROT13('" . $_REQUEST["username"] . "')) " .
" AND SHA1(ROT13(password)) = SHA1(ROT13('" . $_REQUEST["password"] . "'))");

Re: Top-grade, SHA1 Encryption

2011-08-15 09:36 • by Dani (unregistered)
356998 in reply to 356993
GettinSadda:
At least it will make SQL injection just a tiny bit harder as an extra bracket it required that the hacker would not expect.

"Check you sql syntax near `SHA1('1' OR 1=1 --`"
So much harder

CAPTCHA: damnum, a damn number?

Re: Top-grade, SHA1 Encryption

2011-08-15 09:36 • by RealUlli (unregistered)
356999 in reply to 356991
There are more than enough low-paid devs out there turning out code this bad. Unfortunately, there's a market for them, too...

At a guess, it was either some beginner who'd read the basic examples for SQL programming or someone similar from some offshore company...

Captcha: damnum (kinda fitting... ;-)

Re: Top-grade, SHA1 Encryption

2011-08-15 09:38 • by My Name Is Missing (unregistered)
You get what you pay for (are you listening Verizon?)

Re: Top-grade, SHA1 Encryption

2011-08-15 09:40 • by octo (unregistered)
357001 in reply to 356997
ted:
Clearly the WTF is SHA1 encryption. This would've been far better:

$result = mysql_query(
"SELECT * FROM users " .
" WHERE SHA1(ROT13(username)) = SHA1(ROT13('" . $_REQUEST["username"] . "')) " .
" AND SHA1(ROT13(password)) = SHA1(ROT13('" . $_REQUEST["password"] . "'))");


Sssh, Nagesh might actually do this

Re: Top-grade, SHA1 Encryption

2011-08-15 09:42 • by Stev (unregistered)
And yet how many companies, lately, have been found storing stuff in plaintext? By comparison, this seems like a major step up.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:44 • by I don't get it (unregistered)
Why did Paul turn down the offer to have him rewrite the system? It's not like he'd have to keep the SQL injection holes open.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:45 • by Craig (unregistered)
357005 in reply to 357002
They are storing it in plaintext. They are only encrypting it after they pull it out of the database in plain text.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:50 • by Obvious joe (unregistered)
357006 in reply to 357002
You do know that query implies that the username and password are plain text...

Re: Top-grade, SHA1 Encryption

2011-08-15 09:52 • by Dani (unregistered)
357007 in reply to 357005
Craig:
They are storing it in plaintext. They are only encrypting it after they pull it out of the database in plain text.


They are not pulling it out of the database in plain text.. they are sending the plaintext password to the database, then encrypt both (the one they sent and the one present in the database) and then compare the encryptions

Re: Top-grade, SHA1 Encryption

2011-08-15 09:56 • by Some Dude (unregistered)
357009 in reply to 357007
Dani:
Craig:
They are storing it in plaintext. They are only encrypting it after they pull it out of the database in plain text.


They are not pulling it out of the database in plain text.. they are sending the plaintext password to the database, then encrypt both (the one they sent and the one present in the database) and then compare the encryptions


That still means they are in the DB in plain text though.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:57 • by ') OR 1=1 -- (unregistered)
Why can't I login with my username? It's just "') OR 1=1 -- ".

Re: Top-grade, SHA1 Encryption

2011-08-15 09:58 • by C-Octothorpe
Nagesh strikes again...

Re: Top-grade, SHA1 Encryption

2011-08-15 09:59 • by frits
Congratulations, you've discovered an application of SHA-1 as a two-way hashing algorithm.

Re: Top-grade, SHA1 Encryption

2011-08-15 09:59 • by Your Name (unregistered)
357013 in reply to 357001
octo:
ted:
Clearly the WTF is SHA1 encryption. This would've been far better:

$result = mysql_query(
"SELECT * FROM users " .
" WHERE SHA1(ROT13(username)) = SHA1(ROT13('" . $_REQUEST["username"] . "')) " .
" AND SHA1(ROT13(password)) = SHA1(ROT13('" . $_REQUEST["password"] . "'))");


Sssh, Nagesh might actually do this


What is Sssh? Secure SSH?

Re: Top-grade, SHA1 Encryption

2011-08-15 10:00 • by Bobby Tables (unregistered)
Hey there, my name is "Robert'); DROP TABLE Students;-- "

Re: Top-grade, SHA1 Encryption

2011-08-15 10:02 • by Nagesh (unregistered)
357018 in reply to 357001
octo:
ted:
Clearly the WTF is SHA1 encryption. This would've been far better:

$result = mysql_query(
"SELECT * FROM users " .
" WHERE SHA1(ROT13(username)) = SHA1(ROT13('" . $_REQUEST["username"] . "')) " .
" AND SHA1(ROT13(password)) = SHA1(ROT13('" . $_REQUEST["password"] . "'))");


Sssh, Nagesh might actually do this

Not being to understand the problem with this system. Thinking to be SHA1 (standard security algorithm being sucesor to MD5 hash) perfect solution for scenario??? Hackers must be to using the back door comon for implementations in such system where necesary.

Re: Top-grade, SHA1 Encryption

2011-08-15 10:10 • by Those who live in glass houses... (unregistered)
I wish all you ivory tower wannabes would get off your high horses. SHA1 is encryption! Do you even know what encryption means? It means to obfuscate. SHA1 is obsfucation. Now STFU.

An this is for all you pathetic jackwagons posting in SHA1:

68a6a81ff9352dfd1910c2907451fb726886328b

Re: Top-grade, SHA1 Encryption

2011-08-15 10:13 • by dohpaz42
357023 in reply to 357003
I don't get it:
Why did Paul turn down the offer to have him rewrite the system? It's not like he'd have to keep the SQL injection holes open.


I agree; Paul could have just ditched the existing code and rewrote it as if it were a fresh contract. TRWTF is Paul turning the job down.

Re: Top-grade, SHA1 Encryption

2011-08-15 10:15 • by Bobby's mom (unregistered)
357025 in reply to 357016
Bobby Tables:
Hey there, my name is "Robert'); DROP TABLE Students;-- "

Hiya, Bobby Tables!

Re: Top-grade, SHA1 Encryption

2011-08-15 10:21 • by Phil (unregistered)
I think this was done entirely on purpose by a programmer who knows what he needs. One does not need encryption, the database is probably protected by a password already!

But why the SHA1 encryption before comparision you might ask, well it's quite obvious: Backwards compatibilty! Some user might have found a SHA1 collision and now has the habit of being able to use two passwords on the sites that doesn't salt the password before hashing. We don't want to break that users expectations, right?

Don't be too fast to judge someone, always give the benefit of doubt. ;)

Re: Top-grade, SHA1 Encryption

2011-08-15 10:24 • by Adam Parker (unregistered)
These SHA1 jokes don't work as well as the Base64 jokes.

Re: Top-grade, SHA1 Encryption

2011-08-15 10:34 • by QJo (unregistered)
So, metaphoorically speaking: they have a fully-security-approved multi-lock front door, but neglected to use any cement in the brickwork. Shouldn't be a problem, of course, criminals are first and foremost gentlemen and would not dream of using an alternative means of entry into a dwelling but the conventional one.

Re: Top-grade, SHA1 Encryption

2011-08-15 10:36 • by hoodaticus
357035 in reply to 357033
So the little piggies were penny-wise and hired outsourced labor to build a straw house, and then the big bad wolf came and huffed and puffed and blew their house in.

Re: Top-grade, SHA1 Encryption

2011-08-15 10:57 • by A Gould (unregistered)
357038 in reply to 356999
RealUlli:
There are more than enough low-paid devs out there turning out code this bad. Unfortunately, there's a market for them, too...


And there always will be, as long as there are companies that think they can go two orders of magnitude cheaper and think they'll get similar quality.

In contrast, people will spend six-figures for a really nice car, and five-figures for a decent car. If you're only spending four-figures you automatically wonder what's wrong with it.

Re: Top-grade, SHA1 Encryption

2011-08-15 11:00 • by C-Octothorpe
357043 in reply to 357038
A Gould:
RealUlli:
There are more than enough low-paid devs out there turning out code this bad. Unfortunately, there's a market for them, too...


And there always will be, as long as there are companies that think they can go two orders of magnitude cheaper and think they'll get similar quality.

In contrast, people will spend six-figures for a really nice car, and five-figures for a decent car. If you're only spending four-figures you automatically wonder what's wrong with it.
Reminds me of the saying: Fast, Cheap, and Good. Pick two...

Re: Top-grade, SHA1 Encryption

2011-08-15 11:29 • by Some damn Yank (unregistered)
So, if I join this site do I get the option to hide all posts from zunesis? Or should I just erase The Daily WTF from my bookmarks and get back to work?

No, really - if I can't block his posts, I'll simply stop coming here.

captcha: plaga. zunesis is a plaga upon this site.

Re: Top-grade, SHA1 Encryption

2011-08-15 11:43 • by Patrick Magee (unregistered)
PHP and mysql... and an overseas dev/sweatshop too...

What a surprise.

Re: Top-grade, SHA1 Encryption

2011-08-15 11:53 • by QJo (unregistered)
357069 in reply to 357038
A Gould:
RealUlli:
There are more than enough low-paid devs out there turning out code this bad. Unfortunately, there's a market for them, too...


And there always will be, as long as there are companies that think they can go two orders of magnitude cheaper and think they'll get similar quality.

In contrast, people will spend six-figures for a really nice car, and five-figures for a decent car. If you're only spending four-figures you automatically wonder what's wrong with it.



You can of course get a decent car in Britain for four figures. Our workmanship is so much better. (Let's ignore the fact that the currencies are such that "4 figures" in the UK may be considerably more than 4 figures in the US.

Re: Top-grade, SHA1 Encryption

2011-08-15 11:56 • by QJo (unregistered)
357071 in reply to 357057
Some damn Yank:
So, if I join this site do I get the option to hide all posts from zunesis? Or should I just erase The Daily WTF from my bookmarks and get back to work?

No, really - if I can't block his posts, I'll simply stop coming here.

captcha: plaga. zunesis is a plaga upon this site.


I agree. (Goodness gracious, cranky Brit agrees with damn Yank. Must be a first.)

Re: Top-grade, SHA1 Encryption

2011-08-15 11:57 • by redblacktree (unregistered)
I once heard a story about the quality of Indian developers that explained a lot. A consultant that we worked with at my current employer told me of his experience working directly with software engineers in India. (that is, in country. Not over the phone)

He was trying to get some of his teammates to read some software engineering texts like Code Complete, and no one would do it. Eventually, one of them broke down in frustration from being nagged and said, "Look, Bob. In this company's culture, you aim for management. If three years have passed, and you're still a developer, you failed."

So there seems to be a company (if not broader) culture that does not reward engineers. Many companies in the US (including mine) are implementing dual-track career ladders, so that purely technical people can achieve the same rate of pay and benefits as upper-level management. I highly doubt that a similar thing is happening at any Indian developer sweatshops.

So, yeah, I'm not surprised that working with continually neophyte engineers produces crappy projects. Noobs are noobs wherever you go. It's just that in the states, noobs eventually become the experienced engineers. In India, they become managers.

Perhaps these Indian managers could learn something from Herbert Hoover:
"Engineering ... it is a great profession. There is the fascination of watching a figment of the imagination emerge through the aid of science to a plan on paper. Then it moves to realization in stone or metal or energy. Then it brings jobs and homes to men. Then it elevates the standards of living and adds to the comforts of life. That is the engineer's high privilege.

The great liability of the engineer compared to men of other professions is that his works are out in the open where all can see them. His acts, step by step, are in hard substance. He cannot bury his mistakes in the grave like the doctors. He cannot argue them into thin air or blame the judge like the lawyers. He cannot, like the architects, cover his failures with trees and vines. He cannot, like the politicians, screen his shortcomings by blaming his opponents and hope the people will forget. The engineer simply cannot deny he did it. If his works do not work, he is damned....

On the other hand, unlike the doctor his is not a life among the weak. Unlike the soldier, destruction is not his purpose. Unlike the lawyer, quarrels are not his daily bread. To the engineer falls the job of clothing the bare bones of science with life, comfort, and hope. No doubt as years go by the people forget which engineer did it, even if they ever knew. Or some politician puts his name on it. Or the credit it to some promoter who used other people's money ... but the engineer himself looks back at the unending stream of goodness which flows from his successes with satisfactions that few professionals may know. And the verdict of his feloow professionals is all the accolade he wants."

Re: Top-grade, SHA1 Encryption

2011-08-15 12:17 • by derby (unregistered)
357076 in reply to 357002
Stev:
And yet how many companies, lately, have been found storing stuff in plaintext? By comparison, this seems like a major step up.


is my sarcasm detector broken ... because it's still plaintext in the db.

Re: Top-grade, SHA1 Encryption

2011-08-15 12:21 • by Childish (unregistered)
357078 in reply to 357002
Stev:
And yet how many companies, lately, have been found storing stuff in plaintext? By comparison, this seems like a major step up.


You do realize that the WHERE clause has a temporary SHA1 encoding? It's the plaintext passwords that are permanent in the database.

Re: Top-grade, SHA1 Encryption

2011-08-15 12:43 • by Jack (unregistered)
357084 in reply to 357033
QJo:
So, metaphoorically speaking: they have a fully-security-approved multi-lock front door, but neglected to use any cement in the brickwork. Shouldn't be a problem, of course, criminals are first and foremost gentlemen and would not dream of using an alternative means of entry into a dwelling but the conventional one.
Car analogy fail.

Re: Top-grade, SHA1 Encryption

2011-08-15 12:47 • by TechNeilogy (unregistered)
This reminds me of a *hypothetical* security fail we came up with one time. Imagine a marginal coder deciding it would be a good idea to error check *each character* on a password field as the user typed it in.

Re: Top-grade, SHA1 Encryption

2011-08-15 12:47 • by Lee (unregistered)
357088 in reply to 357057
Some damn Yank:
So, if I join this site do I get the option to hide all posts from zunesis?
grep -v

Oh, you're not using Lynx? Sucks to be you...

Re: Top-grade, SHA1 Encryption

2011-08-15 12:52 • by Carl (unregistered)
357090 in reply to 357072
redblacktree:
in the states, noobs eventually become the experienced engineers. In India, they become managers.
Oh goodie, does that mean we can outsource our managers to India? That would fix a lot!

Re: Top-grade, SHA1 Encryption

2011-08-15 13:03 • by [anti-ipod]sis (unregistered)
357094 in reply to 357088
Lee:
Some damn Yank:
So, if I join this site do I get the option to hide all posts from zunesis?
grep -v

Oh, you're not using Lynx? Sucks to be you...

How well does that work?

And yes, being him does involve a form of sucking...

Re: Top-grade, SHA1 Encryption

2011-08-15 13:29 • by airdrik (unregistered)
357106 in reply to 357084
Jack:
QJo:
So, metaphoorically speaking: they have a fully-security-approved multi-lock front door, but neglected to use any cement in the brickwork. Shouldn't be a problem, of course, criminals are first and foremost gentlemen and would not dream of using an alternative means of entry into a dwelling but the conventional one.
Car analogy fail.

A: not all analogies are about cars.
B: Actually it isn't really that bad of a car analogy: a car that has a security-approved multi-lock front door, made with bricks but lacking cement...

Re: Top-grade, SHA1 Encryption

2011-08-15 13:44 • by Beta (unregistered)
357117 in reply to 357003
I don't get it:
Why did Paul turn down the offer to have him rewrite the system?


Perhaps because once he saw just how technically inept and tight-fisted management was, he didn't want to spend the next few months fighting them over dimes and explaining that he couldn't just "fix the bugs" in a day.

Re: Top-grade, SHA1 Encryption

2011-08-15 13:49 • by Beta (unregistered)
357120 in reply to 357090
Carl:
redblacktree:
in the states, noobs eventually become the experienced engineers. In India, they become managers.
Oh goodie, does that mean we can outsource our managers to India? That would fix a lot!


How could an overseas manager lose at golf to a vice-president? I've had managers I could have replaced with a very small shell script, if only I could have gotten past that hurdle.

Re: Top-grade, SHA1 Encryption

2011-08-15 14:12 • by Matt Westwood
357130 in reply to 357087
TechNeilogy:
This reminds me of a *hypothetical* security fail we came up with one time. Imagine a marginal coder deciding it would be a good idea to error check *each character* on a password field as the user typed it in.


PML. "A", nope, doesn't start with "A". "B", nope, "C", aha. "CA", nope, "CB", nope, ...

I remember pointing out to my boss once that the login process as programmed by a contractor once that went something like: "The username was correct but the password was not" (or words to that effect) was less than optimal but he didn't understand what I was trying to point out. Comms fail.

Re: Top-grade, SHA1 Encryption

2011-08-15 15:33 • by Coyne
Why? Why do so many programmers even bother to pretend they know anything about security? They might just as well be honest about it:


$result = mysql_query(
"SELECT * FROM users " .
" WHERE SECURITY_PRETENSE(username) = SECURITY_PRETENSE('" . $_REQUEST["username"] . "') " .
" AND SECURITY_PRETENSE(password) = SECURITY_PRETENSE('" . $_REQUEST["password"] . "')");

Re: Top-grade, SHA1 Encryption

2011-08-15 15:50 • by C-Octothorpe
357157 in reply to 357155
Coyne:
Why? Why do so many programmers even bother to pretend they know anything about security? They might just as well be honest about it:


$result = mysql_query(
"SELECT * FROM users " .
" WHERE SECURITY_PRETENSE(username) = SECURITY_PRETENSE('" . $_REQUEST["username"] . "') " .
" AND SECURITY_PRETENSE(password) = SECURITY_PRETENSE('" . $_REQUEST["password"] . "')");
Because when you're BSing someone, you really only need to know 1% more than the other person to impress them. And because this 1% impresses manager/PM types who have heard the words SHA, encryption, SQL, etc., but don't know how the pieces fit together.

Re: Top-grade, SHA1 Encryption

2011-08-15 16:06 • by Arthur de Jong (unregistered)
357161 in reply to 357003
Why did Paul turn down the offer to have him rewrite the system?

The core of the problem is the customer. They tried to find the cheapest company and apparently didn't care about quality. Those are not the most ideal customers.

Re: Top-grade, SHA1 Encryption

2011-08-15 16:08 • by PedanticCurmudgeon
The Law of the Internet (Troll or be trolled) appears to be in full force today.

Re: Top-grade, SHA1 Encryption

2011-08-15 16:10 • by [anti-ipod]sis - above and beyond the call of duty! (unregistered)
357163 in reply to 357162
PedanticCurmudgeon:
The Law of the Internet (Troll or be trolled) appears to be in full force today.
Shove it up your ass, you self-promoting fag.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment