首页 > 其他分享 >ctfshow 萌新web系列--4

ctfshow 萌新web系列--4

时间:2022-08-27 08:44:24浏览次数:127  
标签:web -- 999 ctfshow 萌新 sql id select row

<html>
<head>
    <title>ctf.show萌新计划web1</title>
    <meta charset="utf-8">
</head>
<body>
<?php
# 包含数据库连接文件
include("config.php");
# 判断get提交的参数id是否存在
if(isset($_GET['id'])){
        $id = $_GET['id'];
    if(preg_match("/or|\-|\\\|\/|\\*|\<|\>|\!|x|hex|\(|\)|\+|select/i",$id)){
            die("id error");
    }
    # 判断id的值是否大于999
    if(intval($id) > 999){
        # id 大于 999 直接退出并返回错误
        die("id error");
    }else{
        # id 小于 999 拼接sql语句
        $sql = "select * from article where id = $id order by id limit 1 ";
        echo "执行的sql为:$sql<br>";
        # 执行sql 语句
        $result = $conn->query($sql);
        # 判断有没有查询结果
        if ($result->num_rows > 0) {
            # 如果有结果,获取结果对象的值$row
            while($row = $result->fetch_assoc()) {
                echo "id: " . $row["id"]. " - title: " . $row["title"]. " <br><hr>" . $row["content"]. "<br>";
            }
        }
        # 关闭数据库连接
        $conn->close();
    }
    
}else{
    highlight_file(__FILE__);
}

?>
</body>
<!-- flag in id = 1000 -->
</html>

跟上一题很类似

/or|\-|\\\|\/|\\*|\<|\>|\!|x|hex|\(|\)|\+|select/i   
#被过滤的字符串

还可以使用上一题的payload

?id='1000'

  

 

标签:web,--,999,ctfshow,萌新,sql,id,select,row
From: https://www.cnblogs.com/Abyssun/p/16629786.html

相关文章

  • PowerShell教程 - 注册表管理(Registry Management)
    更新记录转载请注明出处。2022年8月27日发布。2022年8月27日从笔记迁移到博客。注册表管理(RegistryManagement)进入注册表Set-Location-PathHKCU:......
  • PowerShell教程 - 远程管理(Remoting and Remote Management)
    更新记录转载请注明出处。2022年8月27日发布。2022年8月27日从笔记迁移到博客。远程管理说明(RemotingandRemoteManagement)PowerShell远程连接说明与Telnet和S......
  • PowerShell教程 - 邮件管理(Mail Management)
    更新记录转载请注明出处。2022年8月27日发布。2022年8月27日从笔记迁移到博客。邮件管理(MailManagement)设置SMTP服务器Send-MailMessage-From"[email protected]......
  • curse
    Language:OldEnglish;Origin:cursAcurse(alsocalledanimprecation,malediction,execration,malison,anathema,orcommination)isanyexpressedwishthat......
  • 论文笔记 - Unsupervised Domain Adaptation by Backpropagation
    摘要提出了一个新的深度架构的域自适应方法,可在有大量标记数据的源数据和大量未标记数据的目标域上进行训练该方法促进“深度特征”的出现(深度特征)对于学习任务有主......
  • C#-类
    1、类的声明class类名{//类中的代码}2、类的成员类头:类名类体:字段、属性、方法、构造函数等1、字段就是常量或者变量。若字段未初始化默认为0。namespace......
  • current
    Origin:curant,presentparticipleofcourre'torun',fromLatincurrere]Currentmayreferto:Current(fluid),theflowofaliquidoragasAircurrent,......
  • cur·ric·u·lum
    Ineducation,acurriculum(/kəˈrikjʊləm/;pluralcurricula/kəˈrikjʊlə/orcurriculums)isbroadlydefinedasthetotalityofstudentexperiencesthat......
  • PowerShell教程 - 计算机管理(Computer System Management)
    更新记录转载请注明出处。2022年8月27日发布。2022年8月27日从笔记迁移到博客。计算机管理(ComputerSystemManagement)重启计算机Restart-Computer重命名计算......
  • 面试题做错记录(开卷)
    #JavaScript是一门单线程的静态类型语言错,是动态类型语言#浏览器中的Cookie只能由服务端写入,并且每次网络请求会自动携带Cookiecookie可以在本地用js方法新......