代码审计-TP5框架审计写法分析及代码追踪
    第54天:代码审计-TP5框架审计写法分析及代码追踪 - 图1第54天:代码审计-TP5框架审计写法分析及代码追踪 - 图2
    第54天:代码审计-TP5框架审计写法分析及代码追踪 - 图3
    演示案例:

    • demo代码段自写和规则写分析
    • hsycms-TP框架-不安全写法-未过滤
    • weipan21-TP框架-规则写法-内置过滤

    涉及资源:
    https://github.com/Mochazz/ThinkPHP-Vuln
    https://pan.baidu.com/s/1miETaZcez30jmUEA5n2EWw 提:xiao
    <?php
    namespace app\index\controller;
    use think\Controller;
    use think\Db;

    class Test extends Controller
    {
    public function x()
    {
    echo ‘x test’;
    }

    1. public function testsqlin()<br /> { <br /> //自写数据库查询,存在注入<br /> $id=$_GET['x'];<br /> $conn=mysql_connect("127.0.0.1","root","root");<br /> $sql="select * from injection.users where id=$id";<br /> echo $sql;<br /> $result=mysql_query($sql,$conn);<br /> }
    2. public function testsqlin1()<br /> {<br /> //table('users')->where('id',1)->select();<br /> $id=$_GET['x'];<br /> db('users')->where('id',$id)->select();<br /> }
    3. public function index()<br /> {<br /> $username = request()->get('id/a');<br /> db('users')->insert(['id' => $username]);<br /> return 'Update success';<br /> }

    }