Jump to content

Title: A certain spinach website penetration practice

Featured Replies

Posted

I. Preface

Recently I heard that the website built with a certain qipai product has SQL injection, and someone just sent one.cveyoxgm3hf18542.png

Infiltration of customary routines, a shuttle information collection - vulnerability detection/utilization - privilege raising/authorization maintenance - clean traces

2. Information collection

uy0v3wh02ey18543.png The browser accesses the home page preliminary discovery system: Windows server middleware IIS7.5 Language: ASPX

Port scan nmap -sV -T4 -p- 11x.xx.xx.xx.xx kj4kdlz2xdv18544.png has many open ports. Among them, there are several web services: 80 (current homepage), 81, 82, 88, 4700181: It is the backend of this qipai site. 82: It is also a backend. I don’t know what system it is. There is a verification code 88/47001: Access failed

1433: Database mssql

Also opened 139 and 445 but it was filtered. I don’t know if there is a firewall, so I will look at it later.

Use Dirsearch to scan sensitive directories first. The website language collected earlier is aspx, plus -e specified language

python dirsearch.py -u http://11x.xx.xxx.xx -e aspx t2yeaao2fw118545.png Use 7kbscan again. After all, the dictionary collected here is commonly used by Chinese people

f2qdyi5toku18546.png/m/is the user registration page, which may be useful, remember first

4drczlk4l2t18547.png/test.html is the entrance to adjust the WeChat, it is useless. It may be to guide the victims to chat on the mobile phone.

g5d1mrcbqnl18548.png Check the IP server of a certain operator in Beijing. It is quite bold to build a website in domestic servers.

xnr3322ubfq18549.png Information sorting ah5lgz003my18550.png

It is probably a small site built by myself. I won’t expand and collect new things, so as not to waste time.

III. Vulnerability detection

Focus on the 81 port found earlier, which is the website’s backend management page

vigjpmnnsk518551.png No verification code, just write admin/admin for username/password, grab the package

d12sbrj5gc118552.png The username has a quote and sent a request directly to return an error. If nothing unexpected happens, there should be an error injection or a blind note.

jakv0rmsigf18553.pngSeparate two groups to save this data packet to local qipai.txt, use sqlmap to scan, it is already known that it is an mssql database, plus the --dbms parameter to specify the database type to save time

python sqlmap.py -r qipai.txt --dbms 'Microsoft SQL Server' --dbs Another way, send the packet to the intruder module to explode the password. I tried to enter the username casually in the browser, and the prompt 'User name does not exist'. When entering admin, the prompt 'User name or password is wrong', indicating that the admin account exists, just burst the password.

plm5ol3gfeh18554.png The password is 888999, a weak password, eternal god!

Log in to the background successfully istm0ijuh1z18555.png

There are only 69 registered users, and the rest are all robots. These 69 users have rushed to 1.43 million? Are all the people who play qipai so rich? I am so happy that I can't bear to charge 6 yuan for the first recharge

ne144auqg1p18556.png I can't get involved in gambling, this guy lost 2800 in one day

klfvadd2oyr18557.png After searching in the background for a long time, I couldn't find the upload point, so I put it first

Go back to the other sqlmap and check it out, confirm that there is injection, and you are already jogging the library name

funj3zouq5j18558.png ran out 16 libraries. According to the name, the RYPlatformManagerDB library may contain administrator-related information.

plqkswqpg2c18559.png Running watch name

python sqlmap.py -r qipai.txt --tables -D RYPlatformManagerDB cikkjqm03yb18560.png After searching for a long time, I found an administrator's account and password, which is the one bp burst in the previous bp, and there is some user information, nothing more valuable

python sqlmap.py -r qipai.txt --is-dba gpk0mzri5wm18561.png is DBA permission. Try to get shell, just use sqlmap to blast the path in the mssql database directly

python sqlmap.py -r qipai.txt --The blind spot used by os-shell is slow, and after a long wait, I finally successfully got the shell. It is a technical job on the surface, but in fact it is a physical job

The current user permissions are very small, just a mssql database permission

xn2dd0exw0r18562.png

Systeminfo Check the system information and you can see that the system is 64-bit Windows server 2008

Cobaltstrike generates an attack payload, and then loads it with powershell on the target machine. The target machine is successfully launched

n2ldla5telq18563.png

net user view user

hdwhnn1gkzr18564.pngtasklist viewing process, it should not be pretending to kill soft

nk2nwe4yt2k18565.png

net start to view the enabled services and you can see that the firewall is enabled, so the previous nmap scan 445 and other ports are filtered

mtw10upyqrs18566.png Close the firewall, the right has not been raised yet

z4cfgd54ono18567.png

IV. Raise rights/wei rights

I learned earlier that this machine is Windows Server 2008, so I tried to use potatoes to increase the rights (MS16-075)

ebv55aukjxz18568.png After executing, I waited for a while. I was lucky. The machine was not patched and the authority was successfully raised in one go. I got the system permissions and started doing whatever I wanted.

obdgytypyqn18569.png Enter file management and you can see the test.html file when the previous information is collected.

2x41e3yjmy418570.pngnetstat -ano Check out the port opening situation, 3389 is not opened

ayv2ewqqm5218571.png

Turn on manually

acbvl5xhs1t18572.png can access remote desktop

atgkun5tngo18573.pngcobaltstrike I am not very skilled in operating it, so I should use metasploite to upload a horse generated by msf through cs, and msf enables monitoring

Note: cs can directly derive shell to msf, but I tried it for a long time and never returned the session, so I had no choice but to upload a horse curve of msf to save the country.

uc1hiawbari18574.pngmsf Enable monitoring

zgdvpb0vn4l18575.png Run uploaded horse on cs

j5zu0mdud2218577.pngmsf Successfully obtained the shell, which is the inherited system permissions

xdcf21l4i1j18579.png View password hash, cannot be obtained, because the horse of msf is 32-bit, and the system is 64-bit

hgabavjrbrf18581.pngps view the process, find a 64-bit program running with system permission in the process, and then obtain the hash after migrating the process oh2laegd4bj18583.png

Go to the website that cracks hash online to check the administrator's password. The password is not complicated, and it can be found in a few seconds.

k2wvzj3lbbv18584.pngSuccessfully logged into the remote desktop

01r2iwr3elp18586.png Leave two backdoors, one webshell, and one self-start nc for rebounding shell

pyxeggqcvmh18588.png

5. Clean up traces and retreat

meterpreter's clearv command is cleared with one click

i4qmpecfcpm18590.png

Or manually delete the Windows log

dikciq4e44i18593.png

Six.Summary

idwkyzu4u0r18595.png

7. Experimental recommendation

Manual injection using sqlmap

https://www.hetianlab.com/expc.do?ec=ECID172.19.104.182015011915533100001pk_campaign=freebuf-wemedia

Through the study of this experiment, you can understand SQLmap, master the commonly used commands of SQLmap, and learn to use SQLmap to assist in the injection manually.

Reprinted from the original link:

https://www.freebuf.com/articles/network/250744.html

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.