命令注入漏洞总结

前言

漏洞本身原理很简单,用户的输入作为 要执行命令的一部分被 一些执行系统命令的函数去执行,如果不注意就能够让攻击者执行系统命令。

正文

相关的工具

https://github.com/ewilded/shelling
https://github.com/commixproject/commix

测试环境

win 10 phpstudy
https://github.com/commixproject/commix-testbed/
部署在 http://test.commix.top

一个最简单的例子

/scenarios/regular/GET/classic.php

或取 $_GET['addr']ping 拼接后 由 exec 执行。这种毫无防护的命令注入利用的方式有很多。比如利用 &, &&, | , ||, ;

这里用 www.baidu.com & whoami

使用 commix 来探测

python commix.py -u "http://test.commix.top/scenarios/regular/GET/classic.php?addr=www.baidu.com"

绕过正则表达式

/scenarios/regular/GET/preg_match.php

他这里匹配了 ip 地址的格式。 首尾都匹配了,看似无法注入命令了。不过正则表达式匹配时不会跨行匹配,所以 我们 可以用 \n 来绕过匹配

127.0.0.1\ncommand

更多请看:

https://www.anquanke.com/post/id/84920

https://chybeta.gitbooks.io/waf-bypass/content/ming-ling-zhu-ru/rao-guo-fang-fa.html

http://findneo.tech/171110Bypass4CLimit/

posted @ 2018-08-03 23:43  hac425  阅读(756)  评论(0编辑  收藏  举报