Closed yunxu1 closed 7 years ago
def url2ip(url): """ works like turning 'http://baidu.com' => '180.149.132.47' """ iport = urlsplit(url)[1].split(':') if len(iport) > 1: return gethostbyname(iport[0]), iport[1] return gethostbyname(iport[0])
http://localhost:12@www.baidu.com/
这个文件的url2ip函数在为url解析ip地址的时候可能因为:号分割处理不当解析到其他IP造成ssrf。
标准的URL格式:
协议://用户名:密码@子域名.域名.顶级域名:端口号/目录/文件名.文件后缀?参数=值#标志
如果传递如下url给该函数:
"http://localhost:12@www.baidu.com/"
最后将返回:
('127.0.0.1', '12@www.baidu.com')
任意IP地址解析:
http://0x08080808:www.baidu.com/ http://0x08080808:80@www.baidu.com/
返回:
('8.8.8.8', 'www.baidu.com') ('8.8.8.8', '80@www.baidu.com')
from pocsuite.poc import POCBase, Output from pocsuite.utils import register from pocsuite.api.utils import url2ip class TestPOC(POCBase): name = "url2iptest" vulID = 'test' author = [''] vulType = 'test' version = '1.0' references = '' desc = '' vulDate = '' createDate = '' updateDate = '' appName = '' appVersion = '' appPowerLink = '' samples = [] def _attack(self): return self._verify() def _verify(self): address=url2ip(self.url) result={} result['ipinfo']={} result['ipinfo']['address']=address return self.parse_output(result) def parse_output(self,result): output = Output(self) if result: output.success(result) else: output.fail('Internet nothing returned') return output
希望尽快出个安全靠谱的解析方案。。。
已处理
url2ip解析可能导致ssrf
http://localhost:12@www.baidu.com/
这个文件的url2ip函数在为url解析ip地址的时候可能因为:号分割处理不当解析到其他IP造成ssrf。
标准的URL格式:
如果传递如下url给该函数:
最后将返回:
任意IP地址解析:
返回:
可能有问题的插件写法
希望尽快出个安全靠谱的解析方案。。。