
技术介绍
Assless CHAPs是一种针对MSCHAPv2/NTLMv1交换的快速NT哈希恢复技术,用以快速破解MSCHAPv2-Challenge或MSCHAPv2-Responses。
这种技术需要使用到一个NT哈希数据库,接下来我们会介绍如何从现有列表中创建这些哈希,或者如何将hashcat与字典列表和规则一起使用。
MSCHAPv2交换不需要“破解”明文密码,我们只需要用到NT哈希。
MSCHAPv2会将NT哈希分为三个部分,并使用每个部分作为不同的密钥对同一Challenge进行DES加密。NT哈希分为两个7字节密钥和一个2字节密钥,这意味着最后一个键将填充null,以生成所需长度的密钥。由于DES操作的效率和65535的密钥空间,我们可以快速执行暴力破解。一旦我们拿到了这两个字节数据,我们就可以在数据库中查询所有以这两个字节结尾的NT哈希。这是一种空间与时间的折中,类似于彩虹表。
环境配置和编译
Rust版本需要安装SQLite 3.6.8或更高版本。
Python版本则需要python3、sqlite3和pycryptodome。
数据库创建工具需要使用Ptyon 3和SQLite3命令行接口。
代码编译
代码编译仅能应用于Rust版本,这里需要使用到Cargo。
Cargo安装好之后,先将项目代码克隆至本地,并切换至assless-chaps-rs目录,然后进行项目构建:
git clone https://github.com/sensepost/assless-chaps.git
cd assless-chaps-rs
cargo build --release
生成的代码将会存储在“target/release/”目录下。
技术使用
Assless CHAPs技术要求用到MSCHAPv2-Challenge、MSCHAPv2-Responses和NT哈希数据库。
基础使用方式如下:
./assless-chaps Challenge> Response> hashes.db>
或
python3 assless-chaps.py Challenge> Response> hashes.db>
使用样例
./assless-chaps 5d79b2a85966d347 556fdda5f67d2b746ca3315fd8b93adcab5c792790a92e87 rockyou.db or python3 assless-chaps.py 5d79b2a85966d347 556fdda5f67d2b746ca3315fd8b93adcab5c792790a92e87 rockyou.db
输出数据如下:
[-] Two byte lookup file not provided, will brute force instead.
[+] Found in 22636 tries: 586c
[-] Found 222 hashes ending in 586c
[+] Found hash: 8846f7eaee8fb1
[-] Found after 186 hashes.
[+] Found hash: 17ad06bdd830b7
[+] Full hash: 8846f7eaee8fb117ad06bdd830b7586c
最终的完整哈希“8846f7eaee8fb117ad06bdd830b7586c”就是“password”的NT哈希。
NTLMv1 SSP
针对NTLMv1的使用方式也是一样,使用命令如下:
python3 ntlm-ssp.py lm response> challenge>
比如说,如果我们使用下列NTLMv1-SSP challenge response:
u4-netntlm::kNS:338d08f8e26de93300000000000000000000000000000000:9526fb8c23a90751cdd619b6cea564742e1e4bf33006ba41:cb8086049ec4736c
你需要按照下列方式传递LM和challenge:
python3 ntlm-ssp.py 338d08f8e26de93300000000000000000000000000000000 cb8086049ec4736c
此时,我们将获取到下列响应:
The server challenge is: 724edf24aea0d68b
破解结果如下:
./assless-chaps 724edf24aea0d68b 9526fb8c23a90751cdd619b6cea564742e1e4bf33006ba41 hashes.db
项目地址
Assless CHAPs:【GitHub传送门】
参考资料
https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt
https://www.scottbrady91.com/Authentication/Beware-of-Password-Shucking
https://github.com/hashcat/hashcat/pull/2607