• Quai (unregistered)

    In a new project, this would be bad, but I have seen projects that are trying to do the correct thing by switching to a hash instead of plaintext passwords.

    The problem is that most people forget to remove the column after fixing the code :P

    btw, hashed password != encryped password

  • gmz (unregistered)

    I can't even imagine what a perverse logic hides inside those megabytes :)

    btw: OMG! I can't believe I'm first!! (maybe)

  • Cujo (unregistered)

    I don't see this as a WTF. It's so much easier for support to write a crack in case someone forgets their password. Had they made the table 600 columns, I might agree.

  • Petras (unregistered)

    Your pride made you second.

    Whats the "ullamcorper"

  • (cs) in reply to Quai
    Quai:
    The problem is that most people forget to remove the column after fixing the code :P
    The real question is whether they'd still be using the column with the unencrypted passwords. If not, then the data in there will fall out of date soon enough. (But if they are… erk!)
  • Dominic Pettifer (unregistered)

    "all fields are varchar for simplicity...'"

    If anything that's going to make things more complicated, because now you have type conversions to take care of. Have a datetime value stored as a string and you have to be mindfull of whether it's in EU (31/12/2008) or US (12/31/2008) or some ISO format (2008/12/31). If you end up with a mixture of different formats in your database due to sloppy coding (likely in this case) then you're royally F**KED!

    And then you have INTs stored as strings where you have to perform careful/safe conversions into INT datatypes incase a bunch of characters ends up in the database.

  • John (unregistered)

    "The salt is the name of the company the project is for"

    Negating the fact that the password is stored in plaintext, aren't you supposed to use a salt on a per record basis?

    Also, regarding the VARCHAR issue, I tend to use VARCHAR over CHAR for user inputed data, since (in MySQL) a CHAR field is padded with spaces, so when you retrieve it it strips the trailing spaces. A minor problem if trailing spaces should be retained (unlikely, I know). Also, it appears (again for MySQL) that there is no performance hit when using VARCHAR in INNODB tables, couldn't comment on any engines though. I do however use CHAR for storing HASHES etc.

    Basically, I'm wondering if using VARCHAR should warrant such a sick feeling in the stomach.

  • John (unregistered)

    @Dominic Pettifer

    Hmm, I read "all fields are varchar for simplicity..." as using VARCHAR for text fields only, not for other data types

    If that's the case, it does induce a sick feeling.

  • (cs)

    Wait, is that md5(salt + name + pass) or md5(salt) + name + pass? The first one isn't that insecure. For the second one, is the + operator addition or concatenation? Overflow's a bitch.

  • [twisti] (unregistered) in reply to John
    John:
    Basically, I'm wondering if using VARCHAR should warrant such a sick feeling in the stomach.

    Uh, Sherlock, the point is that he used VARCHAR for EVERYTHING. That includes numbers, booleans, dates (as you can see in the screenshot), etc.

  • My kybrd s brkn (unregistered)

    The comment is a VARCHAR for simplicity.

  • My Name (unregistered)

    Fortunately for the developer, my opinion of him is encrypted to avoid hurting his feelings: !*7#

    Fortunately for the rest of us, my opinion is also posted in unencrypted format: WTF?

  • John (unregistered) in reply to [twisti]
    [twisti]:
    John:
    Basically, I'm wondering if using VARCHAR should warrant such a sick feeling in the stomach.

    Uh, Sherlock, the point is that he used VARCHAR for EVERYTHING. That includes numbers, booleans, dates (as you can see in the screenshot), etc.

    I don't tend to take in the image in an article, but from looking at it, I can only see him using VARCHAR for text & a date. userid is an INT. An INT is a number isn't it Watson?

  • Scott (unregistered)

    That's not that bad. My old company stored the password unencrypted too. They also stored the CC number and all other relevant and related info. First, you aren't supposed to store that at all and then they wouldn't encrypt it. That whole company is a giant WTF.

    off-topic: Why not use re-captcha on the site?

  • Survey User 2338 (unregistered)

    "Now, I'd have thought this might be intentional, except that two of the states a transaction can be in are CANCELED and CANCELLED_TX"

    So what is your point? You can spell the past tense of cancel with either one "L" or two. In Texas, they typically spell it with two because everything is bigger in TX which is the RW the F!

  • (cs)

    Perhaps this whole codebase should be submitted and considered for a MAJOR WTF AWARD. Alex, are you listening? A Tony/Emmy/Clio award for WTF!

  • (cs) in reply to John
    John:
    "The salt is the name of the company the project is for"

    Negating the fact that the password is stored in plaintext, aren't you supposed to use a salt on a per record basis?

    The whole point of salting is that a guy can't precompute a massive list of all the common passwords. Same salt for all users is more secure than nothing, as the dude can't attack you with the same list he used to attack somebody else. But a per user salt would be infinitely more secure.

    That said, he seems to be doing md5(salt + name + pass), so effective_salt == (salt + name). Hence, unique salt per user. The username alone wouldn't be terribly helpful, as the guy could find out if jsmith:swordfish had an account on multiple sites. but jsmith:[email protected] will hash to something completely different from jsmith:[email protected]

  • (cs) in reply to Survey User 2338
    Survey User 2338:
    You can spell the past tense of cancel with either one "L" or two. In Texas, they typically spell it with two because everything is bigger in TX which is the RW the F!
    My dictionary says that the two "L" variant is correct on this side of the Pond. Hence, I'm pleased to see that Texas is getting it right for a change!
  • (cs)
    I don't tend to take in the image in an article, but from looking at it, I can only see him using VARCHAR for text & a date. userid is an INT.

    Alex put that image there. It's not part of the story.

  • Dave (unregistered)

    "all fields are varchar for simplicity...'"

    gawd, the lead developer at the place I used to work at did that. Everything was a varchar in the database, even dates. It also extended to his VB6 spaghetti which stored everything, even dates within his timesheet application, as strings (in slightly different formats everywhere so there were tons of different functions just to calculate differences between 2 times, etc).

  • (cs) in reply to John
    John:
    @Dominic Pettifer

    Hmm, I read "all fields are varchar for simplicity..." as using VARCHAR for text fields only, not for other data types

    You read
    all fields are varchar for simplicity
    as
    all text fields are varchar for simplicity
    ? You either don't read very well, or you hallucinate quite brilliantly!
  • (cs) in reply to Survey User 2338
    Survey User 2338:
    You can spell the past tense of cancel with either one "L" or two.

    That's beside the point. It was spelled 2 ways within the one code base. How do you know which spelling you should be using when you go to refer to it next?

  • (cs) in reply to dkf
    dkf:
    I'm pleased to see that Texas is getting it right for a change!
    Texas doesn't "get it right". Texas decides what is right.

    Chuck Norris is a Texas Ranger.

  • Gonzo (unregistered) in reply to Survey User 2338

    It's true.

    When I went to Dallas for a business meeting, my weasel grew by about two inches.

  • Inspector Detector (unregistered) in reply to DaveK
    DaveK:
    @Dominic Pettifer

    ? You either don't read very well, or you hallucinate quite brilliantly!

    ! In my hallucination you put random chars in the beginning of every line.

  • Chris C (unregistered) in reply to ParkinT
    ParkinT:
    Perhaps this whole codebase should be submitted and considered for a MAJOR WTF AWARD. Alex, are you listening? A Tony/Emmy/Clio award for WTF!

    Wouldn't a WTF award be a Paula?

  • Brandon (unregistered) in reply to Survey User 2338
    The salt is the name of the company the project is for. Well, no. It's a misspelling of the name, with two typos out of six letters.

    Axcoim? I mean Acxiom?

  • (cs) in reply to Code Dependent
    Code Dependent:
    dkf:
    I'm pleased to see that Texas is getting it right for a change!
    Texas doesn't "get it right". Texas decides what is right.

    Chuck Norris is a Texas Ranger.

    Ummm, actually Chuck Norris is someone who PRETENDS to be a Texas Ranger.

  • Global Warmer (unregistered) in reply to vt_mruhlin
    vt_mruhlin:
    Wait, is that md5(salt + name + pass) or md5(salt) + name + pass? The first one isn't that insecure. For the second one, is the + operator addition or concatenation? Overflow's a bitch.

    Yeah, maybe you should find a new career

  • nipplecramps (unregistered) in reply to Inspector Detector
    Inspector Detector:
    DaveK:
    @Dominic Pettifer

    ? You either don't read very well, or you hallucinate quite brilliantly!

    ! In my hallucination you put random chars in the beginning of every line.

    It's not a comment, it's a stored procedure. @Dominic is a parameter of type Pettifer. The question mark is just a unary if operator.

  • (cs) in reply to Walleye
    Walleye:
    Code Dependent:
    dkf:
    I'm pleased to see that Texas is getting it right for a change!
    Texas doesn't "get it right". Texas decides what is right. Chuck Norris is a Texas Ranger.
    Ummm, actually Chuck Norris is someone who PRETENDS to be a Texas Ranger.
    Actually, Chuck Norris PRETENDS to be somebody who actually IS a Texas Ranger.
  • regdate-redgatr (unregistered)

    "The salt is the name of the company the project is for"

    Is that the name of the company in the screenshot of the schema?

    Looks like a well known vendor of SQLServer tools to me spelled wrong.

  • (cs) in reply to Bombe
    Bombe:
    Walleye:
    Code Dependent:
    dkf:
    I'm pleased to see that Texas is getting it right for a change!
    Texas doesn't "get it right". Texas decides what is right. Chuck Norris is a Texas Ranger.
    Ummm, actually Chuck Norris is someone who PRETENDS to be a Texas Ranger.
    Actually, Chuck Norris PRETENDS to be somebody who actually IS a Texas Ranger.
    You guys need to bone up on your Chuck Norris Facts:

    Chuck Norris counted to infinity... twice.
    Chuck Norris doesn't sleep. He waits. When Chuck Norris does a pushup, he isn't lifting himself up; he's pushing the earth down.

    And... Chuck Norris IS a Texas Ranger.

  • Dirk (unregistered) in reply to Code Dependent
    Code Dependent:
    Bombe:
    Walleye:
    Code Dependent:
    dkf:
    I'm pleased to see that Texas is getting it right for a change!
    Texas doesn't "get it right". Texas decides what is right. Chuck Norris is a Texas Ranger.
    Ummm, actually Chuck Norris is someone who PRETENDS to be a Texas Ranger.
    Actually, Chuck Norris PRETENDS to be somebody who actually IS a Texas Ranger.
    You guys need to bone up on your Chuck Norris Facts:

    Chuck Norris counted to infinity... twice.
    Chuck Norris doesn't sleep. He waits. When Chuck Norris does a pushup, he isn't lifting himself up; he's pushing the earth down.

    And... Chuck Norris IS a Texas Ranger.

    And Texas Rangers pretend to be Chuck Norris.

  • Buddy (unregistered) in reply to Dave
    Dave:
    "all fields are varchar for simplicity...'"

    gawd, the lead developer at the place I used to work at did that. Everything was a varchar in the database, even dates. It also extended to his VB6 spaghetti which stored everything, even dates within his timesheet application, as strings (in slightly different formats everywhere so there were tons of different functions just to calculate differences between 2 times, etc).

    OMG, did we work at the same place? Did he also not use Option Explicit so that variable mispellings would be quietly ignored? Did his timesheet schema have a table with Sun Mon Tue Wed Thu Fri & Sat as field names so that if you needed to calculate monthly, you needed fourteen variations of the same query? Did he have his own toaster oven next to him and stink up the office every afternoon with the smell of bacon or fries?

  • l33t Cod3r 2 (unregistered) in reply to Buddy
    Buddy:
    Dave:
    "all fields are varchar for simplicity...'"

    gawd, the lead developer at the place I used to work at did that. Everything was a varchar in the database, even dates. It also extended to his VB6 spaghetti which stored everything, even dates within his timesheet application, as strings (in slightly different formats everywhere so there were tons of different functions just to calculate differences between 2 times, etc).

    OMG, did we work at the same place? Did he also not use Option Explicit so that variable mispellings would be quietly ignored? Did his timesheet schema have a table with Sun Mon Tue Wed Thu Fri & Sat as field names so that if you needed to calculate monthly, you needed fourteen variations of the same query? Did he have his own toaster oven next to him and stink up the office every afternoon with the smell of bacon or fries?

    I can hear you I'm right here!

  • derby (unregistered) in reply to Cujo

    Hmmm ... maybe it's 463 different, poorly-indexed tables.

  • Jr (unregistered)

    Strictly speaking, calculating an MD5 hash isn't 'encryption' since the hash isn't meant to be decrypted.

    (one-way encryption, maybe?)

    </nitpick>
  • (cs)

    No WTF here, as long as your database is encrypted properly. Just go to Tools - Security - Encrypt/Decode Database, and then select your MDB file and then it is secure. I don't know why more people don't take the time to do this simple measure.

    Besides if you encrypt the password itself, it becomes harder to make a password retrieval web page.

    Those are just my thoughts, from experiencing securing my company's infrastructure.

  • FIA (unregistered) in reply to TopCod3r
    TopCod3r:
    No WTF here, as long as your database is encrypted properly. Just go to Tools - Security - Encrypt/Decode Database, and then select your MDB file and then it is secure. I don't know why more people don't take the time to do this simple measure.

    Besides if you encrypt the password itself, it becomes harder to make a password retrieval web page.

    Those are just my thoughts, from experiencing securing my company's infrastructure.

    I've been catching up with TDWTF this afternoon, and you sir are a comedy genius. :)

    Thank you. :)

  • (cs) in reply to John
    John:
    Also, regarding the VARCHAR issue, I tend to use VARCHAR over CHAR for user inputed data, since (in MySQL) a CHAR field is padded with spaces, so when you retrieve it it strips the trailing spaces. A minor problem if trailing spaces should be retained (unlikely, I know).

    When a CHAR field is retrieved in any RDBMS, trailing spaces are not stripped, they are added. If you enter a single character into a CHAR(5) column, you end up with the single character plus 4 spaces. If you don't want the spaces, you have to trim them yourself.

    The difference with a VARCHAR has nothing to do with stripping (or losing, for that matter) trailing spaces. A CHAR always takes it's defined amount of storage, while a VARCHAR takes up only what's needed. If you want trailing spaces in a VARCHAR column, you can have them - just add them to the value before you store it.

    John:
    Also, it appears (again for MySQL) that there is no performance hit when using VARCHAR in INNODB tables, couldn't comment on any engines though. I do however use CHAR for storing HASHES etc.

    There's no difference in performance in any DB. The difference is in the amount of storage required. A CHAR(100) always uses the space required for 100 * SizeOf(Char) regardless of content, while a VARCHAR(100) doesn't; the VARCHAR will take the size of the actual data + a slight amount of overhead.

    John:
    Basically, I'm wondering if using VARCHAR should warrant such a sick feeling in the stomach.

    Yes. What the OP and comments to it were referring to is the improper use of VARCHAR. For example, defining a column that you know will store date values as VARCHAR. It makes comparisons and other operations more difficult, since you always have to convert from VARCHAR to DATETIME. You also have to worry about different formats; using the proper datatype allows the DB to make sure only valid data is stored.

    I'd suggest that, before you post any more of your DB wisdom in public, you take a basic course in databases. Any "Teach Me SQL" or "SQL for Dummies" book will improve your knowledge greatly.

  • K (unregistered) in reply to Survey User 2338

    The point is consistency.

  • (cs) in reply to KenW
    KenW:
    John:
    Also, it appears (again for MySQL) that there is no performance hit when using VARCHAR in INNODB tables, couldn't comment on any engines though. I do however use CHAR for storing HASHES etc.

    There's no difference in performance in any DB.

    Almost, but not entirely true. When a table contains no variable length fields, searching on a non-indexed field will be slightly faster, since the DBMS always knows exactly where in a record a given field will be - it doesn't have to spend time looking at each individual record to determine the variable field sizes.

    Of course, given that strict requirement for the added performance, it's not a very frequent scenario - and as a matter of fact, MySQL versions prior to 5.0.3 would silently convert CHAR columns (of 4 or more characters) to VARCHAR once you had any variable-length columns.

  • jes5199 (unregistered)

    I'm also working on a project with "password_plain" and "password_encrypted" columns in the database! Is this a recurring WTF?

  • (cs) in reply to Quai

    Holy shit, is this "seebs" from http://www.seebs.net ?

    If so, dude, you were one of my inspirations as a programmer. What are you doing working on WTF projects?

  • (cs)

    Yes, that's what you do when you mess up the first time but don't want to lose anything.

    Attempt 1: Canceled Attempt 2: Cancelled Attempt 3: Cancellled . . .

  • (cs) in reply to Global Warmer
    Global Warmer:
    vt_mruhlin:
    Wait, is that md5(salt + name + pass) or md5(salt) + name + pass? The first one isn't that insecure. For the second one, is the + operator addition or concatenation? Overflow's a bitch.

    Yeah, maybe you should find a new career

    Seriously, what kind of comment is that anyhow? I mean, I'm not in the security business, so finding a new career would be irrelevant (unless I accidentally mistook a complement for an insult). But put some substance in your posts instead of just saying "u r stoopid".

    So, how would you properly salt something and how would you go about attacking the first option from this one in such a way that a properly salted password wouldn't be vulnerable?

  • (cs) in reply to Survey User 2338
    Survey User 2338:
    "Now, I'd have thought this might be intentional, except that two of the states a transaction can be in are CANCELED and CANCELLED_TX"

    So what is your point? You can spell the past tense of cancel with either one "L" or two. In Texas, they typically spell it with two because everything is bigger in TX which is the RW the F!

    The point is consistency. Programmers should be the most consistent people when it comes to syntax, spelling and which caps they use.

    If you had a constant named CANCELLED, you could not then call that constant by using CANCELED.

    So why you would have enum values of CANCELED AND CANCELLED, both spelled differently, albeit correctly. You would always be forgetting which one was which.

    It doesn't take a genius to figure that out.

    It's the same as if you always start your class names with caps (and you should), then making a class name start with a lowercase is not very good practice.

    The worst thing is when somebody mispells a variable (in it's declaration). And as opposed to fixing the typo, they propogate the entire file with the mispelling.

  • That's why they call it a sense of humor (unregistered)

    "The point is consistency. Programmers should be the most consistent people when it comes to syntax, spelling and which caps they use...blah, blah, blah..."

    Thank you Captain Obvious for explaining in tiresome detail what every good programmer already knows. The point really is that it's a JOKE. Sure it is a little more subtle than "Knock, knock...who's there?", but it is a joke nonetheless. Pretty much everyone else got it.

  • jmucchiello (unregistered) in reply to DaveK
    DaveK:
    John:
    ]all text fields are varchar for simplicity
    ? You either don't read very well, or you hallucinate quite brilliantly!
    Or making all fields VARCHAR (text or otherwise) is so great a WTF that his mind supplied the "missing" word "text" rather than allow him to contemplate the true horror before him. It's a defense mechanism, really.

Leave a comment on “Encrypted For Your Security”

Log In or post as a guest

Replying to comment #:

« Return to Article