2021-06-06 · 1

LOS #3 goblin write-up

securitypwnable

这篇文章发布已超过两年,内容可能已过时。


什么是 LOS?

这个 LOS(Lord Of SQLInjection)是一个可以练习 SQL Injection 的 Web 黑客练习网站。

关于 SQL Injection,请读这篇 [黑客/Web 黑客] - SQL Injection ~嘿。

[黑客/Web 黑客] - [LOS] #2 cobolt write up <- 第 2 题

解题过程

看第 3 题,好像和之前有点不一样!

$query = "select id from prob_goblin where id='guest' and no={$_GET[no]}"; 

看查询语句,id 值固定为 guest,用户输入的部分似乎是 no= 这里。而且~

if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
if($result['id'] == 'admin') solve("goblin");

这部分就是要解决的地方,和上一题很像吧?似乎 id 值变成 admin 就搞定了!那就按之前一样的方法输入吧。

no=id=admin%20%23 这样输入后,

似乎像这样检测到了特殊字符。

if(preg_match('/\'|\"|\`/i', $_GET[no])) exit("No Quotes ~_~"); 

那么往 no 里放个基础值 1 试试?

它把我们当 guest 打招呼……我们想成为 admin,所以放个别的值。放 2、3、4 试试。

!> ****](https://www.easycalculation.com/ascii-hex.php)

什么都没显示?看来是 false!那就按下面写。select id from prob_goblin where id='guest' and no=23 or id='admin' ↳ 往 no 里放个 false 值使其为假,再用 or 把 id 变成 admin。 啊,但如上面尝试过的,特殊字符被拦了。那该怎么办呢?答案就是用 ASCII 码。用它再写一遍?**select id from prob_goblin — ascii-hex.php 在这样的网站上可以轻松获取 ASCII 码。


原文(韩语): tistory — 发布于 2021-06-06,已迁移至本博客。本翻译由 AI 协助完成。

评论

删除这条评论?

相关文章

LOS #3 goblin write-up · 나봄하랑