Stories
Slash Boxes
Comments

News for nerds, stuff that matters

The Dangers of Improper Cookie Use

Posted by CmdrTaco on Mon Dec 18, 2006 01:22 PM
shifted89 writes "Over the last year, the security community have exposed web application security for what it is — extremely lacking. However, for all the focus on XSS, CSRF, history stealing, etc., not much attention has been given to the cookie. Unfortunately, cookie misuse can be just as dangerous, if not more so than XSS attacks and InformIT illustrates why. In short, the author clearly demonstrates what can happen when a website improperly uses cookies for customer tracking — including a working illustration."

Related Stories

[+] Your Rights Online: Delete Cookies, Inflate Net Traffic Estimates 217 comments
eldavojohn writes "In my browser, I regularly go to the tools menu and clear my private data. This includes my cookies. As a result, people like me who destroy cookies by the thousands may be inflating estimates of Web traffic by up to 150 percent. People have good reasons for clearing out cookies — we've heard about bad cookies before (and I think the FCC is still investigating the issue). But every time you delete cookies, many of the sites you've visited count you as a new visitor next time."
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Old News (Score:5, Funny)

    by MyLongNickName (822545) on Monday December 18 2006, @01:28PM (#17289382)
    (Last Journal: Saturday October 14 2006, @08:12AM)
    Cookie misuse has been chronicled here [bbc.co.uk]
    • Remember.. by Swimport (Score:2) Monday December 18 2006, @01:52PM
    • Re:Old News by Kabuthunk (Score:1) Monday December 18 2006, @01:57PM
    • Re:Old News by xlordtyrantx (Score:1) Monday December 18 2006, @03:25PM
      • Re:Old News by Anonymous Coward (Score:1) Monday December 18 2006, @03:38PM
    • Re:Old News by sharkey (Score:2) Monday December 18 2006, @04:13PM
    • 2 replies beneath your current threshold.
  • Cookies? Javascript? Etc? (Score:5, Funny)

    by Anonymous Coward on Monday December 18 2006, @01:28PM (#17289396)
    I disable them all because I hate any innovation of the web past 1991. Anyone who disagrees with me is wrong. This article is proof.
  • by Bright Apollo (988736) on Monday December 18 2006, @01:29PM (#17289412)
    (Last Journal: Friday February 02 2007, @11:08AM)
    ... but isn't this old news? Hacking (plaintext) cookies is about as innovative as hacking URLs or telnetting into your office SMTP server to write fake CEO emails to the new guy.

    Still.. I'm off to get my $4 off coupons from Restaurant.com, ad-free weather from Wunderground.com, and free schools data from GreatSchools.net...

    -BA

    • 1 reply beneath your current threshold.
  • Obligatory (Score:2, Informative)

    by Archangel Michael (180766) on Monday December 18 2006, @01:29PM (#17289418)
    (Last Journal: Wednesday September 22 2004, @11:13AM)
    Me Like Cookies! - Cookie Monster
  • If you think that's bad try going to a page like this [scriptingmagic.com] with IE after copying and pasting sensitive information.
  • cookies passed as plaintext (Score:3, Informative)

    by brunascle (994197) on Monday December 18 2006, @01:31PM (#17289450)
    Second, cookies are passed as plaintext unless there is an encrypted session. As a result, anyone with a sniffer can capture the cookies contents and use them as their own.
    bingo. that's why i store the IP address along with the session ID in the database.
  • practical, perhaps? (Score:5, Insightful)

    by fermion (181285) on Monday December 18 2006, @01:36PM (#17289526)
    (Last Journal: Thursday May 03 2007, @11:34AM)
    I was going to read the article until the 5th cookie was set at which point i just assumed that the entire thing was an practical lesson. Be stupid enough to read an article about cookie abuse and get caught in the trap. Sort of like trying to find a windows virus filter only to find that the virus filter has infected you.

    Oh well, I guess this is just another lesson in how marketers will shoot themselves in the foot. Animated gifs are abused, so i turn animation off. Cookies are abused, so i reject any cookie that is not obviously necessary. Flash is useful, but no way to request that it does not start automatically, so either I don't install it or install a hack to block it. I don't even see the product that is being advertised.

    I hope this gets everyone off thier high horse, and realize that third party cookies should be rejected on all machines by default. What I really wish existed was a screen that popped up every time you went to a new site that informed the user of the site, and asked for a cookie preference for that site. That way, all cookies could be accepted at the corporate site, and no cookies might be accepted at google.

  • How old is this article? (Score:5, Insightful)

    by Dekortage (697532) on Monday December 18 2006, @01:41PM (#17289604)
    (http://www.cheapcheap.biz/)

    It says "updated Dec 15, 2006" but the comments at the end of the article are all dated from 2004. I mean, the problem is much older than that, but it seems the article was just updated with 2006 dates to make it seem more current. Or am I missing something?

  • by D4rk Fx (862399) on Monday December 18 2006, @01:49PM (#17289720)
    (http://fxaffinity.com/)
    There's only one simple rule to follow. The client can never be trusted, and all information should be verified server side.
  • I like how the first thing the 'cookie misuse' site is doing is trying to do is to set a cookie. The 'why' remains unknown.
    Other things they do is prohibit tabbed browsing by using javascript to open an image from a thumbnail to a new window. Can someone please send these guys to a usability crash-course?
  • I love the start of this article (Score:3, Insightful)

    by fullphaser (939696) on Monday December 18 2006, @01:51PM (#17289742)
    (http://www.fullphaser.com/)
    As it references XSS attacks and then jumps to cookie abuse like it is something newer than XSS, I mean you know the whole web 2.0, almost everything being session and cookie based, yes turn those boogers off their dangerous, and return to the safe land of 1998 where static web pages reigned supreme. The fact is that we can't just dismiss the cookie, yes we can play safely in the field with it, but past that it is a integral part of today's web infrastructure and there is no short term replacement for it, between JS, ASP, and PHP all nearly relying on the whole concept of the cookie to validate session etc. You can't just say they are dangerous and to stop accepting them in general, and you can't just tell the web designer to stop using them, for the primary reason that it isn't practical.
  • Maybe (Score:3, Informative)

    by RAMMS+EIN (578166) on Monday December 18 2006, @01:53PM (#17289776)
    (http://inglorion.net/ | Last Journal: Thursday October 06 2005, @07:17AM)
    ``"Over the last year, the security community have exposed web application security for what it is extremely lacking. However, for all the focus on XSS, CSRF, history stealing, etc., not much attention has been given to the cookie.''

    Maybe that's because the dangers of cookies have been known for AGES?
  • Worse and worse (Score:4, Informative)

    by Dracos (107777) on Monday December 18 2006, @01:53PM (#17289778)
    (http://www.fylo.net/)

    Cookie abuse reached new heights a few weeks ago when top sites in Google search results throw cookies on the search results page. So far it's not a guaranteded occurance, and only happens for the top search result. Still, it's jumping the gun.

    I can't wait for the Mozilla devs to clean up their cookie code so that blocking cookies is as easy and configurable as blocking images. Even being able to prompt to block everything other than a session cookie would be a nice improvement.

    • Re:Worse and worse by i.r.id10t (Score:2) Monday December 18 2006, @01:58PM
    • Re:Worse and worse (Score:5, Informative)

      by afidel (530433) on Monday December 18 2006, @02:14PM (#17290054)
      That's because your browser is pre-downloading the content from those sites, so yeah they are going to send their normal cookies. Turn off the preload feature and problem solved.
      [ Parent ]
    • Re:Worse and worse by Dracos (Score:2) Monday December 18 2006, @02:54PM
    • Re:Worse and worse by evilviper (Score:2) Monday December 18 2006, @06:31PM
  • Use AJAX? (Score:1)

    by bb5ch39t (786551) on Monday December 18 2006, @01:57PM (#17289824)
    I'm just asking. But it seems to me that if a Web site were designed to use AJAX, then the entire "session" would be a single communications, so no cookies would be needed to "track" the user interaction.

    Or am I full of you-know-what again?

    • Re:Use AJAX? by Shados (Score:2) Monday December 18 2006, @02:18PM
    • Re:Use AJAX? by iwan-nl (Score:2) Monday December 18 2006, @02:31PM
    • 1 reply beneath your current threshold.
  • by MrCopilot (871878) on Monday December 18 2006, @02:04PM (#17289904)
    (http://www.mrcopilot.com/ | Last Journal: Tuesday August 02 2005, @10:10AM)
    The Real Danger of Improper Cookie Use:

    Two Words: Crumby Milk

    Thank You and Tip your Servers.

  • by Illusion2269 (959341) on Monday December 18 2006, @02:07PM (#17289960)
    Mindy: What's wrong?
    Homer: Oh, yeah, like you don't know. We're gonna have sex!
    Mindy: Oh...well, we don't have to.
    Homer: Yes we do! The cookie told me so.
    Mindy: Well...desserts aren't always right.
    Homer: But they're so sweet!
  • OMG cookie misuse! (Score:2)

    by suv4x4 (956391) on Monday December 18 2006, @02:12PM (#17290024)
    There are way more subtle ways to misuse cookies than demonstrated here.

    This article shows us that you shouldn't let people in only by username without their password. Well duh.
  • by smooth wombat (796938) on Monday December 18 2006, @02:13PM (#17290040)
    (Last Journal: Friday November 09, @01:18PM)
    I read the article and the author talks about the usual stuff: what cookies are, what they contain and how they track you. Then he goes on to say that since some of the cookies expire in 2009, a lot of information could be collected on you during this time.

    As is said everytime the issue of cookies comes up, DELETE THEM! You don't need to keep them.

    Once you delete them, you're a new, unique visitor to a web site. You screw with their statistics since they think you're someone new, thus increasing their advertising budgets because they think they have more visitors.

    There is no reason to keep cookies. Delete them and laugh everytime you read stories like this.
  • Sigh... (Score:1)

    by alisson (1040324) on Monday December 18 2006, @02:14PM (#17290052)
    So used to Fark, that I thought it meant the pastry for a moment...
  • by sherriw (794536) on Monday December 18 2006, @02:17PM (#17290106)
    Ok... if you're storing the session id via cookie... what's the best solution for preventing cookie theft abuse? Pardon my stupidity for not knowing this already...
  • More "Cookie Monster" Hysteria (Score:5, Informative)

    by Doc Ruby (173196) on Monday December 18 2006, @02:21PM (#17290166)
    (http://slashdot.org/~Doc%20Ruby/journal | Last Journal: Thursday March 31 2005, @01:48PM)
    The "friendly" article does start off sensibly, mentioning that "Cookies are not programs, they can't read your personal data, and they don't cause spam.". OK, main scary cookie myths put aside.

    FTFA:
    This value pair is my personal identification code that can be used to track my movements across the internet and build a profile about my surfing habits. This is possible because a cookie can be read at any time by the domain that owns it. As a result, when I visit Slashdot.org, doubleclick.net will attempt to read its cookie that is on my computer. This will provide doubleclick.net with my id value, and their database will be updated. In other words, they now know that I like to visit Informit.com and Slashdot.org. Already their profile on my surfing habits can tell them I am probably a computer geek.


    That section about the "personal identification code" talk is very weaselly. It makes cookies sound like any website can read a cookie on your computer that's flagged as "owned" by that website at any time. Cyrus Peikari and Seth Fogie (article authors) leave out the important, necessary link: the DoubleClick cookie can be read only when your computer makes an outgoing HTTP connection to DoubleClick. Like when a DoubleClick banner ad is included in a Slashdot page's HTML. Which HTTP request includes a CGI param (REFERER) pointing to the Slashdot page from which the IMG tag instructed the computer to pull the DoubleClick banner image. That's how Doubleclick gets its cookie, and the context that you visited a Slashdot page.

    DoubleClick cannot read its cookie any other time, when there's no HTTP connection from your computer to DoubleClick. Like all the rest of the pages on which DoubleClick has no banner or other "self-clicking" link. There are web bugs, invisible images tags embedded in other pages just to hit their server with the REFERER of the page triggering their bug, updating your computer's cookie with their counter (etc). But they cannot be read "at any time".

    Besides, the cookie is a nonessential part of this snooping. DoubleClick doesn't need to keep its counter on your computer - the IMG hit can update its server-side counter DB. It can ID you, though not as precisely, by your IP# and other CGI parameters you send with every HTTP request. Or DoubleClick's deal with, say, Slashdot, is that Slashdot encode the DoubleClick banner IMG tags the Slashdot server sends you with its pages with a unique ID, like your Slashdot userid. ACs and public terminals mostly escape, but they're not really targets for these marketdroids.

    And you can turn off cookies in any non-retarded browser, making them anonymous (encoded IMG URLs are much harder - see?). And you can inspect the cookies stored on your computer.

    All these issues were discussed in great detail by the HTTP Working Group as we invented cookies, almost a decade ago. Some people were philosophically opposed to letting untrusted servers store any data on users' computers. Though every page, every image is stored on users' computers, after retrieval for presentation. And we realized that stopping cookies would mean only people with money to make "cross-site" deals and maintain large centralized databases would get the power to exploit cookies for tracking. So the cost would motivate more profit-exploitation of the tech. Ultimately only profiteers would track you, and there'd be plenty of them, without even the local control that cookies offer. And the entire Web would lose even voluntary easy tracking of intersession client state.

    We decided to make cookies simple and use them. They're mostly harmless - a good balance with the huge benefit they deliver all day long in the Web Era. But I guess there's still profit to be made by scaring people on the Web, like the naive "technologists" to whom this InformIT article is directed, with incorrect cookie hysteria, and offers to help protect us.

    That's the way the cookie crumbles.
  • Cookies (Score:5, Informative)

    by KermodeBear (738243) on Monday December 18 2006, @02:44PM (#17290492)
    (http://www.kermodebear.org/)
    I have a friend who works for a medical software company. Their system handles all kinds of personal information; SSNs, medical records, body scans, etc. The authentication is cookie-based; All the information about a user's access is a serialized, base64 encoded data structure.

    Yup, you heard it right. base64 decode your cookie, change a few values, stick it back in... Ta-da, you're an admin.

    Improper cookie use can be a nasty, nasty thing. The worst part is that this problem was brought up to the lead developer, who had originally wrote this auth system, but... "Well, it is base64 encoded, noone will ever figure that out." Yeah, right.
    • Re:Cookies (Score:5, Informative)

      If I see a nonsensical combination of upper and lower case letters, numbers, and punctuation, especially if it has one or two equal signs tacked onto the end, I immediately think "base64!".

      Firefox allows base64 encoding for data: urls, and we can use this to make a quick-n-dirty base64 decoder. Just type data:text/plain;base64, (including the comma) into the address bar and paste the string on the end, and hit enter to see the decoded string (if it's plaintext).

      Base64 is not encryption and it should not be used where encryption is needed (or in this case, a secure DATABASE). Base64 is a way to represent binary data in plaintext without having to worry about data corruption due to non-binary safe programs.

      [ Parent ]
    • Re:Cookies by accessdeniednsp (Score:2) Monday December 18 2006, @08:38PM
      • 1 reply beneath your current threshold.
  • Let's discuss something new (Score:4, Informative)

    by claes (25551) on Monday December 18 2006, @02:47PM (#17290536)
    Firefox 2 includes the new WHATWG-specified client-side persistent storage [whatwg.org]. However, some argue it is critically flawed [dreamhost.com]. Learn the arguments now and we can discuss this further on Slashdot in 2010!
  • by dmatos (232892) on Monday December 18 2006, @03:01PM (#17290736)
    that when I read the title, I expected an article about the dangers of chocolate chips, maimings performed with oatmeal-raisin, and death by fudgee-o's? Hrm, methinks I should have a snack.
  • by BarnabyWilde (948425) on Monday December 18 2006, @03:03PM (#17290774)
    ...outdated
    • 1 reply beneath your current threshold.
  • Cookie Expiry (Score:1)

    by ebob9 (726509) * on Monday December 18 2006, @03:10PM (#17290888)
    One of the great features of a cookie that the article leaves out is the fact that servers don't need to set an Expiry date.

    If you don't set an expiry date, the cookie is temporary, and will not be stored to disk. It will be deleted/destroyed when the browser is closed.

    Cookies with SessionID information should ALWAYS be temporary, or no Expiry date. Anyone who sets a cookie with sensitive information with an expiry date is asking for trouble, plain and simple.
  • Enough Already! (Score:2)

    by h4ck7h3p14n37 (926070) on Monday December 18 2006, @07:13PM (#17294574)
    (http://www.kittenwar.com/)

    Anyone want to guess how many more stupid articles we're going to see explaining the basics of how HTTP, cookies or Javascript works? I find it amusing, yet sad, that so many people are pointing out web vulnerabilities that are nothing more than a n00b not understanding how someting works and either misconfiguring it or using it improperly.

    I'm sorry, but cross-site scripting attacks are not real vulnerabilities! The problem is that your stupid browser can execute Javascript that's allowed to read local files and send data out over the network. The problem is not some forum maintainer allowing people to post Javascript, the problem is that you're allowing it to run. Turn Javascript off! It's garbage.

    As for cookies being used improperly, what's so hard to understand? It's a file that's stored on a client's system. Under no circumstances should you store data you don't want the client to see, nor should you blindly trust the data the client provides.

    Let's not even get into form validation. Apparently a lot of "web developers" don't understand the difference between an HTTP server and HTML content. No, just because you limited that pulldown to three options in your HTML doesn't mean the client can't send something else in its POST request.

    I can't help but to wonder where companies are finding all of the idiot web developers.

  • Old news (Score:1)

    by infofc (979172) on Monday December 18 2006, @07:25PM (#17294692)
    Hmm, not even old, more like ancient use. It's as basic as it gets. Idiots will always get a chance to create software, so it's hardly surprising that you can find dumb site implementations.
  • HttpOnly cookies (Score:1)

    by dumky (598905) on Monday December 18 2006, @07:26PM (#17294700)
    (http://blog.monstuff.com/)
    The article mentions the vulnerability of cookies to XSS attacks. There is actually a way of protecting cookies from javascript, by using the HttpOnly option. It was introduced in IE6. Hopefully, it will get implemented in other browsers too, as it is a step forward in security for cookies.

    http://msdn.microsoft.com/workshop/author/dhtml/ht tponly_cookies.asp [microsoft.com]
  • by pablo_max (626328) on Monday December 18 2006, @10:58PM (#17296384)
    seriously, that headline really freaked my out!! I had just eating like 18 cookies!! Doesn't look like this applies to me though. Thank god for that.
  • Misuse? (Score:1)

    by teebob21 (947095) on Tuesday December 19 2006, @12:07AM (#17296850)
    Clearly we are all ignoring the true danger of improper cookie use: a fat ass.
  • 9 replies beneath your current threshold.