[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Find the vulnerability /g/! If correct, when CryptoAPI.sha1.hash(x)

You are currently reading a thread in /g/ - Technology

Thread replies: 22
Thread images: 1
File: tumblr_nzr1xa45j71tkxvxvo1_540.jpg (54 KB, 507x676) Image search: [Google]
tumblr_nzr1xa45j71tkxvxvo1_540.jpg
54 KB, 507x676
Find the vulnerability /g/!

If correct, when CryptoAPI.sha1.hash(x) is called, you should be able to run arbitrary code on the machine you're attacking. Assume that x is a value controlled by the attacker.

     1    var CryptoAPI = (function() {
2 var encoding = {
3 a2b: function(a) { },
4 b2a: function(b) { }
5 };
6
7 var API = {
8 sha1: {
9 name: 'sha1',
10 identifier: '2b0e03021a',
11 size: 20,
12 block: 64,
13 hash: function(s) {
14 var len = (s += '\x80').length,
15 blocks = len >> 6,
16 chunk = len & 63,
17 res = "",
18 i = 0,
19 j = 0,
20 H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0],
21 w = [];
22
23 while (chunk++ != 56) {
24 s += "\x00";
25 if (chunk == 64) {
26 blocks++;
27 chunk = 0;
28 }
29 }
30
31 for (s += "\x00\x00\x00\x00", chunk = 3, len = 8 * (len - 1); chunk >= 0; chunk--) {
32 s += encoding.b2a(len >> (8 * chunk) & 255);
33 }
34
35 for (i = 0; i < s.length; i++) {
36 j = (j << 8) + encoding.a2b(s[i]);
37 if ((i & 3) == 3) {
38 w[(i >> 2) & 15] = j;
39 j = 0;
40 }
41 if ((i & 63) == 63) CryptoAPI.sha1._round(H, w);
42 }
43
44 for (i = 0; i < H.length; i++)
45 for (j = 3; j >= 0; j--)
46 res += encoding.b2a(H[i] >> (8 * j) & 255);
47 return res;
48 }, // End "hash"
49 _round: function(H, w) { }
50 } // End "sha1"
51 }; // End "API"
52
53 return API; // End body of anonymous function
54 })(); // End "CryptoAPI"
>>
>JS
all of it
>>
we're not here to do your homework
>>
If this is your homework, you know more than the professors in our school and you should be proud of yourself.
>>
I can't code but I'm gonna guess it has something to do with chunk not being defined before wrest of code is written.
>>
>>53362735
You did it last night man
>>
>>53362801
Nope
>>
>>53362500
I'm not gonna secure your code for you when I get paid to do this shit.
>>
>Assume that x is a value controlled by the attacker

What did you do with x? WHERE IS IT I DON'T SEE X.
>>
>when CryptoAPI.sha1.hash(x) is called, you should be able to run arbitrary code on the machine you're attacking

That won't happen.
>>
>>53362500
If I were to guess, and I've never worked with javascript, I would say it has something to do with 4 null terminators in a row(x7F character might help you).

What have you tried so far?
>>
>>53364666
It actually can though, lol
>>
>>53364954
Pls demonstrate, senpai
>>
I found your classmate's solution online

the key to solution is 3EFUWXSG
>>
>>53365576
Hahaha that's equivalent to Babbies first javascript injection and OP had to resort to the neckbeard legion to figure it out.
>>
>>53365576
link?
>>
>>53365576
U wot mate how does this work
>>
>>53365576
That doesn't do shit other than the extra alert that was added to the script.
>>
>>53362500
>JS
Found it.
>>
>>53366009
ebin
>>
>>53366009
>>53362714
It's funny because that actually turned out to be the answer.
>>
>>53367578
.
Thread replies: 22
Thread images: 1

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK