11 ms·
HTML5 localStorage allows sites to fill up users' hard disks
- yefim323 14y agoI was really annoyed by the fact that the "disk filling" started as soon as I clicked the link. However, the point really hit home. Is there a solution for this browser-side? EDIT: The link has been changed to the blog post describing the phenomenon. Good riddance!
- feross 14y agoYou can use Firefox. Firefox actually implements a reasonable storage limit policy for this. 10MB for an entire domain (all subdomains included)
- dragontamer 14y agoI was wondering why it wasn't working, lol. Got stuck at 5MB for me.
- briansmith 14y agoI bet it would still work in Firefox but it would be more expensive, because you'd need to purchase a lot of top-level domains to pull it off.
- chc 14y agoIf you're willing to spend tens of thousands of dollars, there are better ways to mess with somebody's computer.
- dhbanes 14y agoBut at $185,000 a piece, who will be doing that?
- briansmith 14y agoActually, you'd only need to buy one TLD! Or, you could buy one regular domain and then ask to be put on the public suffix list. I'm guessing that would have the same effect for less money.
- feross 14y agoWow, being put on the public suffix list is an interesting idea. How would one go about doing that?
- e12e 14y agoInteresting question. I wonder if you could get into this list (without nefarious purpose) if you provided some major hosting service? Eg: I see k12-schools in the US are on that list, it would make sense to allow someone providing shared hosting to get on the list (to avoid users setting cross-domain cookies). Eg: appspot.com and blogspot.* is on the list[1]. More information: http://publicsuffix.org/submit/ (and the rest of the site, obviously) [1] http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/ef...
- deleted 14y ago[deleted]
- SiVal 14y agoYou don't need to purchase any top-level domain, just a bunch of regular domains: dearleader000001.kp, dearleader000002.kp, .... If you are, say, the North Korean government, or have a close relationship with some small island registrar, you can register any number of domains you like for peanuts.
- gordaco 14y agoFor those interested in changing the amount of storage per domain in firefox: about:config -> dom.storage.default_quota. Also, dom.storage.enabled to change whether you use local storage at all or not. I don't know if chrome or iexplore also give those options. It's nice that this exploit is presented openly as a proof of concept, and includes a button to undo the damage. Many people, upon finding this, would try to use it for shadier ends.
- lerouxb 14y agoHow does Firefox determine if something is a domain or a subdomain? Obviously the term subdomain is relative, so domain.com is already a subdomain of .com. But what about countries like the UK or South Africa where domains are commonly subdomains of .co.uk and .co.za? Is there some generic way to know when a domain should be treated as a subdomain or do they basically hardcode the exceptions? Example: does domain1.co.uk and domain2.co.uk share the same limit in Firefox? Probably not, but how does it know to treat them as separate?
- feross 14y agoThere's a hardcoded list of TLDs in the browser's source code. They update it from time to time whenever there's a new .co.uk style TLD to add.
- lerouxb 14y agoI see there's a list online: http://publicsuffix.org/ http://publicsuffix.org/
- kalleboo 14y agoThere are already hardcoded lists for this that's used to limit the scope of cookies (so nobody can try to read all the cookies on *.uk). I imagine these lists will become a real headache when the recent TLD auction is over. Is there any work being done on a more dynamic system (DNS TXT fields?)
- martin_ 14y agoSo apparently this is where you file IE bugs http://connect.microsoft.com/IE http://connect.microsoft.com/IE - i'm not sure if it's expected or ironic that it's broken. Great find btw!
- hobs 14y agohttp://connect.microsoft.com/directory/non-feedback http://connect.microsoft.com/directory/non-feedback It's actually on the list of items not currently "receiving feedback" whatever that means.
- yuhong 14y agoThat is because MS just released IE10 for Win7.
- halter73 14y agoIf you are signed in with a Microsoft account everything seems to work. Terrible UX though. Nothing indicates you need to sign in.
- Flenser 14y agoThis is the url for the feedback form. It redirects to a login page if you're not logged in. https://connect.microsoft.com/IE/feedback/CreateFeedbackForm.aspx?FeedbackFormConfigurationID=5034&FeedbackType=1 https://connect.microsoft.com/IE/feedback/CreateFeedbackForm...
- muglug 14y agoMitigation: there's an option in chrome://flags that converts all these images to dog pictures.
- jiggy2011 14y agoGot to ~800MB and then chrome crashes.
- benatkin 14y agoI made it to 1.6GB. Leaving it there until I need the space. :)
- mablae 14y agoHow is that done? Isn't there a limita Limit of 5Mb(?) per Domain definend in the HTML5 Spec for LocalStorage?
- iProject 14y agoper SUBdomain. So just use: example.com 1.example.com 2.example.com ...
- Kerrick 14y agoIn the spec, it's per domain. As implemented in Chrome/Safari/IE, it's per subdomain.
- kevincrane 14y agohttp://feross.org/fill-disk/ http://feross.org/fill-disk/ He explains here that most browsers (except Firefox) don't follow the standard close enough, and ignore the exception for subdomains, i.e. 1.filldisk.com, 2.filldisk.com, etc.
- wisty 14y agoWait, haven't I heard this song before? It's the one about cookies, and .co.uk (i.e. every commercial site in the UK) sites all sharing the same cookies, because they all look like subdomains. Or was it all .friendly-hosting-company.com sites? The fundamental problem is, there's no easy way to distinguish domains and subdomains.
- desas 14y agoIt doesn't happen for .co.uk, it does happen for .nhs.uk (by design). http://publicsuffix.org/ http://publicsuffix.org/ has the list that you use to distinguish
- lutze 14y agoBecause most of the browser vendors see "standards" as more like "suggestions". I'm sure any web developer will tell you it's been a problem from the moment there was more than one browser. This is just a particularly hilarious example.
- mcnemesis 14y agoIs there a means to inspect (and or modify) what apps are putting into my local storage? something similar to cookie inspection?
- benaiah 14y agoIn Chrome, you can go to Settings->Advanced Settings->Content Settings->Cookies->All Cookies and Site Data, and it will list sites using your localStorage.
- mcnemesis 14y agoThanks, gave me a chance to peek at which sites/apps have been running experiments on my box (web db stuf,...). The thing I still find disturbing is that unlike cookies, it seems not easy/direct to view the contents of a localstorage (other than its meta-data).
- pilif 14y agoIt's cumbersome, but visit the site in question and use the web inspector. The resources tab lists the various keys and values for that site.
- tantalor 14y agoExample of what this looks like, http://imgur.com/jYc0nHU http://imgur.com/jYc0nHU
- newman314 14y agoThere does not seem to be a way to disable localStorage entirely.
- nwh 14y agoIn Webkit based browsers, the inspector will list localstorage use in the "storage" pane. http://i.imgur.com/9fAjLQr.png http://i.imgur.com/9fAjLQr.png
- viseztrance 14y agoThe message is OK, but personally I have an issue with websites playing sound without my consent.
- leetrout 14y agoAgreed. But while we're on the topic- what is that song?
- thejsjunky 14y agoIt's known as the "troll" or "trololo" song. Can't be bothered to remember it's real name. https://www.youtube.com/watch?v=sTSA_sWGM44 https://www.youtube.com/watch?v=sTSA_sWGM44
- leetrout 14y ago10 internets to you, good sir. I just saw the name in the source code on GitHub (facepalm). Thanks for the link to the video; highly entertaining!
- scw 14y agoMr. Trololo himself: https://www.youtube.com/watch?v=oavMtUWDBTM https://www.youtube.com/watch?v=oavMtUWDBTM http://en.wikipedia.org/wiki/Eduard_Khil http://en.wikipedia.org/wiki/Eduard_Khil
- benatkin 14y agoOK, why does YouTube get a free pass on this? Nobody has ever given me a good reason.
- jonchris 14y agoits ok for youtube as you know you are landing on sound world. you know it. however suppose u clicked a link abcxyz.com and u don't know much about the site as u wanted to read some article/news etc and all of sudden u hear music. what if music is strange and ur speaker is on in the office? :-)
- benaiah 14y ago(Mildly OT) Well, that's interesting. The link has been changed since it was posted - it originally pointed directly at the demo which began to fill your disk. Is this a mod thing, or can the original submitter do it? Either way, it was a good call. Automatically playing music and filling my hard drive with no warning is a terrible idea.
- feross 14y agoI'm the author. Looks like the mods changed the link and spoiled my fun ;)
- catshirt 14y agoi liked that when i originally clicked the link it filled my harddrive and played music. satire, people.
- nannasin28 14y agoI have an issue with websites playing sound without my consent. http://www.hqew.net http://www.hqew.net
- tquai 14y agoAhhh.... I wrote a response wondering out loud why this doesn't work on my browser, then checked the source, and it's javascript. No wonder, I browse without it! "Yeeaahhpp, with enough javascript one can blow up just about anything." ~Tyler Durden
- kevincennis 14y agoHow do you know if someone browses with JavaScript disabled? Don't worry, they'll tell you.
- AdamTReineke 14y agoFYI, if you're on IE10, hitting the Stop button seems to throw a local storage exception and doesn't clear the space.
- AdamTReineke 14y agoAnd if anybody knows how to reclaim that space, let me know... Clearing cache and cookies for the domain didn't work.
- frankacter 14y agoClearing the Storage Areas Session state is released as soon as the last window to reference that data is closed. However, users can clear storage areas at any time by selecting Delete Browsing History from the Tools menu in Internet Explorer, selecting the Cookies check box, and clicking OK. This clears session and local storage areas for all domains that are not in the Favorites folder and resets the storage quotas in the registry. Clear the Preserve Favorite Site Data check box to delete all storage areas, regardless of source. http://msdn.microsoft.com/en-us/library/cc197062%28v=vs.85%29.aspx#_clear http://msdn.microsoft.com/en-us/library/cc197062%28v=vs.85%2...
- feross 14y agoAuthor here. It works for me. I test on IE10 on Windows 8.
- AdamTReineke 14y agoOh, I guess it is working, just super slowly. Literally only reducing by around 2MB of cache per second (+/- 1MB), currently at 2120MB. [Edit: perf is very back and forth. Slow, then fast, then slow again. It does work though.]
- m_st 14y agoReminds me how filing bugs with Microsoft is such a pain! There's no category for Windows 8 on MS Connect, so when we found a bug in Windows 8 RTM I found the name of an MS employee working on the feature in question on the MSDN forums, then through Google found his LinkedIn profile where he luckily published his eMail address. Microsoft should be ashamed. It seems like the best way to file a bug these days is to create a blog post and publish it to HN, Reddit or so...
- UnoriginalGuy 14y agoI'm actually aware of a very significant user impacting bug in Windows 8 (hint: It can cause every process in your startup/autorun list to not start consistently). But have no way to report it to them... Has impacted my system multiple times since upgrading to Windows 8. Fortunately I know a work-around (eject the optical disc in the optical drive) but still -- annoying that I cannot even report it.
- quotemstr 14y agoI might be able to help; please provide contact information.
- m_st 14y agoGood luck getting anything done for it. The bug we found is affecting a lot of Swiss customers (I admit Switzerland isn't so big) and it took a month until I got a useful reply. Now we have a bug number and were told that the issue should be fixed "early this year" and changes would be checked in in March. Whatever that means... At least their employees were kind enough to reply to my eMail. But this company should really improve their error reporting.
- DigitalSea 14y agoPlease sir, may I have some more? This is awesome. I got to 935mb of space used before Google Chrome on Windows 7 64bit crashed dramatically. However, good news, when I restored the tabs it resumed right where it left off filling up my hard drive.
- rplnt 14y agoI got to over 2GB and then Chrome crashed (not dramatically, just a tab). Fun fact is that I was not running the "exploit" in Chrome. I was testing it in Opera and I suspect that it was cheating and allocating more and more memory for all the local storage instead of dumping it out to hard drive. So system run out of memory and something had to go.. I still find it funny that it was Chrome :)
- DigitalSea 14y agoHaha yeah, that is a bit strange. When Chrome crashed for me it was every process, not just the one tab which I rarely see happen these days. Lets hope the Chrome team implement a fix for this ASAP, not holding my breath on an IE fix for at least a year or so given their prior history for patching things.
- hosay123 14y agoDid it literally crash, or just hang? One joyful misfeature of LevelDB (which forms the basis of Chrome's implementation) is that when a particular write rate is exceeded for a sustained period, LevelDB will fall behind merging old segments and block hard, often for minutes on spinning rust, until it catches up. But hey, who cares about by-design black swan latency characteristics for real world use cases when the published benchmarks look so great.
- eksith 14y agoWell this is frightening. You don't even need to create subdomains since basically anyone with wildcard subdomains enabled can do this without a sweat. All you need is a random number generator and rewrite x.domain.com to domain.com and the browser is none the wiser. Though I can't quite imagine why anyone would want to do this to some random stranger. Unless you knew the visitor or had some means of personally identifying him/her, there are more devastating ways of filling up a remote HD with just an IP and hostname (nmap and friends come to mind).
- loeg 14y agoSorry, maybe this is obvious, but — how do you fill up a remote HD with just an IP and hostname with nmap and friends?
- eksith 14y agoWell, I meant you can use these tools to gain access to the remote machine to do some real damage. Nmap and friends are usually for finding running services, list of open ports, knock on a few doors (run some queries?) etc... and if someone were to gain access to a machine this way, filling up their hard drive may not be on their list of priorities. Unless incrimination was the intention.
- mkjones 14y agoCompromising an up-to-date machine is usually a bit harder than just pointing nmap at it and enumerating running services. Getting someone to visit a web site is relatively easy.
- tripzilch 14y agoReally. I assumed you were talking about some nmap-based attack I hadn't heard of. That maybe fills the target's HD with log files or something. Wondered whether that would work cross-platform on any device, like this attack. Wondered whether it could be pulled off by an idiot with a grudge, like this attack. Or whether targeting someone by IP isn't in fact actually harder than being able to do it by getting someone to click on any link, anywhere. But yes, indeed, if the machine's already vulnerable to something else, then that is possibly much worse.
- Untit1ed 14y agoFinally a good non-ideological reason to use Firefox :)
- pilif 14y agoSo. The question I'm asking myself now is how to fix this. Giving <wildcard>.domain.com a shared quota will allow one tumblr or github pages user to monopolize all storage, effectively removing local storage for this kind of scenario (also removing it for the host which is even more annoying). A maybe workable solution would be to only allow creation of new keys for the first-party origin. What I mean is that whatever.example.com has full access if that's what the user is currently viewing directly in their browser. <wildcard>.example.com embedded via iframes could either get read-only access, or read-write access for existing keys. Also maybe limited to, lets say, 4K. This sounds like a really complicated solution though. Any better ideas?
- jaredsohn 14y agoLimit how much can be placed in localstorage regardless of site based on time. (Or perhaps prompt whenever that limit is reached, in case there is a legit reason for it.) This isn't perfect in that your localstorage could still be filled up slowly if you leave a page open in the background, but I think this solution is robust to many different techniques.
- rtpg 14y agoPrompt is the best solution to this. There's a prompt with flash.
- ygra 14y agoPrompt is a horrible solution from a UX perspective. Essentially you're asking the user a question you, as a developer, couldn't or didn't want to answer. But the user has no idea either. Heck, she doesn't even know that there are limits in place or what DOM local storage even is.
- simias 14y agoI don't think it's a problem of the developer not knowing, they generally do know how much storage they'll need (or at least put an upper limit). It's a problem of trust. Maybe the dev things they'll need 1GB but I'm not ready to give them that. The same way the apps asks for certain privileges when you install an app on, say, android. I wonder why anybody thought it was a good idea to let any web page store some random stuff on my computer. Cookies were bad enough already. You know, you can say what you want about Flash, but I least I could block it. These days I can't browse half the web if I disable javascript. One of these days I'll just run my browser with a separate UID just so I can keep it under control. Or better yet, a VM, since it appears people want to turn the browser into an OS anyway.
- tantalor 14y agoSome analysis of how this works, 1. The main page contains an iframe which serves this script: https://github.com/feross/filldisk.js/blob/master/static/frame.html https://github.com/feross/filldisk.js/blob/master/static/fra... 2. This script writes a 2,500,000-length string to local storage, which should occupy at least 2.5Mb (probably much more). This matches the maximum storage per sub-domain. 3. This script then reloads the iframe on a different subdomain but the same script. GOTO 2.
- frozenport 14y agoOpera is safe! It prompts for most disk space.
- hoodoof 14y agoWouldn't this have earned the guy a $60,000 Chrome bug bounty if he had reported it through the right channels?
- yaix 14y agoJust ask the user if its okay, like with geo data, translate web site, etc. "Allow example.com to track your location?" [Yes] [No] "Allow a1.example.com to store x MB of data locally?" [Yes] [No] Also > The HTML5 Web Storage standard was developed to allow sites to store larger amounts of data (like 5-10 MB) than was previously allowed by cookies (like 4KB). Main difference is that cookies are uploaded to the server with each request, while localStorage is not.
- afhof 14y agoThat is a good way to never ever ever use a feature again. "Frightening Message: This website wants to do something scary. Do you want to allow some bad thing to happen to your computer?" That is how lay people, i.e. the people needed to mass adoption, read browser requests for Geo, storage, and other permissions. It would be better to have sane and safe defaults in the browser, rather than pester the user. Would cookies have worked if the browser asked for permission on every website?
- JoachimSchipper 14y agoWould cookies be used for tracking you everywhere if the browser asked for permission on every use? Would this be a good or bad thing? (It's not like keeping state in the URL is hard - using cookies just looks marginally better.)
- im3w1l 14y agoThen, if you were logged in to a site, you would only be logged in, in that particular tab.
- yaix 14y agoBrowsers like Chrome do it with geolocation for example. If it is required for the user to get a certain service they want, what's the "scary" part? You can say no and use the parts of the site that work with it, or yes and get the extra functionality. Like with geolocation.
- 14y ago
- chris_wot 14y agoIs there a bug logged with Mozilla?
- jfoster 14y agoFirefox isn't vulnerable to this.
- okamiueru 14y agoHere is how it looked in Opera: http://i.imgur.com/SOoadOB.png http://i.imgur.com/SOoadOB.png
- espadrine 14y agoToo bad that outstanding solution will be vaporized from the face of this earth and replaced by Chrome's implementation!
- eCa 14y agoWhy is it assumed that Opera will be exactly the same as Chrome? Is it not possible for Opera to keep their own implementation of LocalStorage (and other things)? Am I wrong in assuming RenderEnginge != Browser?
- rplnt 14y agoThat's just a bug in the exploit that it accidentally used more than 5 MB per subdomain. I got the same prompt, but when I tried to run it again in private tab and the limit was not hit. It got to over 2GB before something bad happened (Chrome's tab process crashed).
- curiousdannii 14y agoThe Chromium developers really dislike localStorage (http://code.google.com/p/chromium/issues/detail?id=58985#c7 http://code.google.com/p/chromium/issues/detail?id=58985#c7) They'll have to fix this bug, but I won't be surprised if they try to remove localStorage entirely soon.
- romaniv 14y agoIt sound like they hate synchronous APIs. Well, the synchronous nature of it wouldn't be a problem if: 1. JS has a language-level support for asyncrony. 2. The implementation of retrieval was performant enough or allowed for some way to control granularity of reads from the code. I really dislike that the idea that the only simple API for local storage will be gutted because of reasons quite tangential for what it does.
- khuey 14y agoSo synchronous APIs wouldn't be a problem if they were 1. Asynchronous or 2. Guaranteed to be really really fast? You do realize that the problem is that you can't guarantee that spinning rust will be fast, right?
- kevingadd 14y agoI think he said that asynchronous APIs are a problem because they're hard to use well from JS, and that the performance of localStorage is a problem in part because the granularity of reads and writes is poorly specified. Both of these things are true.
- chrismorgan 14y agoHTML5 localStorage does not allow sites to fill up users' hard disks (without their permission). Bad, non-conforming implementations do.
- sfaruque 14y agoI'm working on writing a guide on how to use localStorage to publish on www.localstorage.org. Should I include a part about the possible abuses?
- TheAnimus 14y agoThis could be quite a problem for users of SSDs who lack TRIM support. IIRC Apple were selling mac book airs with no trim support if the user didn't pay to upgrade OSX. If a malicious user felt so inclined they could with just a few domains create a bit of a write load that would quickly fragment and hurt the performance of the SSD.
- deleted 14y ago[deleted]
- farseer 14y agoThe solution is simple but ugly: A root domain www.example.com can utilize upto 10MB of storage while sub-domains count towards that storage limit. Any domain trying to access more will automatically result in a user prompt. An exemption can be made for domains/subdomains that present a valid SSL certificate, the whole idea is to prevent abuse.
- harshreality 14y agoHow would that work if the malicious page used IP addresses instead of hostnames? Then it's only a matter of how many IP addresses the author can use.
- pixl97 14y agoBeing that IPv4 addresses are something that's having a bit of a shortage these days, it's not at the top of the list of things to worry about. That said, if you're one of the few that has IPv6 access, this could turn in to an issue pretty quick.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- __herson__ 14y agoFirefox 16 in Linux Mint isn't affected http://i.imgur.com/xD17VZK.jpg http://i.imgur.com/xD17VZK.jpg
- nightpool 14y agoIE10 public bug site, btw: http://connect.microsoft.com/IE/SelfNomination.aspx?ProgramID=4792&pageType=1 http://connect.microsoft.com/IE/SelfNomination.aspx?ProgramI...
- bzbarsky 14y agoThis is why Firefox has a quota on localStorage, per eTLD+1. Of course people keep complaining about this quota...
- hbe_ 14y ago*checking if cuckoobox.com is available
- pcwalton 14y agoThis kind of thing is a good reason why a monoculture would be bad for the Web. It's entirely possible that, if WebKit had a monopoly, Web sites would rely on subdomains' space not being counted toward the parent domain's space, and it'd be impossible to fix this bug without breaking the Web. But because we don't have a monoculture and some browsers implemented subdomain limits, Web sites haven't been able to rely on WebKit's behavior. So WebKit will be able to fix the bug without breaking the Web—which is better for WebKit, and better for the Web.
- akandiah 14y agoWould this work on an Android device with Froyo/Gingerbread? Because, some of those devices will never be updated. Hence, this can be used to practically disable a device.
- redmattred 14y agoThis is also possible using the FileWriter API (currently only supported by Chrome: http://caniuse.com/filesystem http://caniuse.com/filesystem). Oddly enough, Google Chrome prompts you to grant file system access, but doesn't explicitly tell you how much space is being asked for.