OpenParable
Skip to content
← Back to skills

Database Tactics

DevOps & Security
database-tactics

Database Tactics is an Agent Skill for devops & security published in the wgpsec/AboutSecurity repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

数据库服务攻击方法论。当发现 Redis(6379)、MSSQL(1433)、PostgreSQL(5432)、MySQL(3306)、MongoDB(27017) 等数据库端口时使用。覆盖未授权访问、弱口令爆破、命令执行、文件读写、提权。任何涉及数据库攻击、数据库提权、数据库利用的场景都应使用此技能

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/wgpsec/AboutSecurity/blob/HEAD/skills/postexploit/product/database-tactics/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/database-tactics, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

数据库服务攻击方法论

数据库是内网渗透的核心跳板——几乎每个应用都有数据库后端,而数据库通常有操作系统级的能力。

⛔ 深入参考(必读)


Phase 1: 数据库识别

端口服务攻击优先级
6379Redis⭐⭐⭐ 未授权概率高
1433MSSQL⭐⭐⭐ xp_cmdshell 直接 RCE
5432PostgreSQL⭐⭐ 命令执行能力强
3306MySQL⭐⭐ UDF 提权
27017MongoDB⭐⭐ 未授权概率高
1521Oracle⭐ 利用复杂

Phase 2: 通用攻击流程

发现数据库端口?
├─ 1. 尝试未授权访问(空密码/匿名)
├─ 2. 弱口令爆破(默认账号 + top100)
├─ 3. 已知漏洞利用
├─ 4. 进入数据库后:
│   ├─ 搜索敏感数据(用户表/配置表/flag)
│   ├─ 尝试命令执行
│   └─ 尝试文件读写
└─ 5. 操作系统提权

Phase 3: 快速未授权检测

# Redis
redis-cli -h TARGET ping
# 返回 PONG → 未授权

# MSSQL(默认 sa 账号)
netexec mssql TARGET -u sa -p '' --local-auth
netexec mssql TARGET -u sa -p 'sa' --local-auth

# PostgreSQL
psql -h TARGET -U postgres -w
# 空密码测试

# MySQL
mysql -h TARGET -u root --skip-password

# MongoDB
mongosh --host TARGET --eval "db.adminCommand('listDatabases')"

Phase 4: 弱口令爆破

# 通用爆破(netexec 支持多种协议)
netexec mssql TARGET -u userlist.txt -p passlist.txt --local-auth
netexec ssh TARGET -u userlist.txt -p passlist.txt

# 常见默认账号
# Redis: 无认证 / requirepass 常为弱密码
# MSSQL: sa / sa, sa / 空, sa / 123456
# PostgreSQL: postgres / postgres, postgres / 空
# MySQL: root / root, root / 空, root / 123456
# MongoDB: admin / admin, 无认证

Redis 速查(最常见)

# 未授权连接
redis-cli -h TARGET

# 信息收集
INFO server
CONFIG GET dir
CONFIG GET dbfilename

Redis 关键利用路径:

  • 写 Webshell / SSH 密钥 / Crontab
  • 主从复制 RCE
  • Lua 沙箱逃逸

→ 密码爆破 / Cluster / Sentinel 详情 → references/redis-attack.md

MSSQL 速查

# 连接
impacket-mssqlclient DOMAIN/sa:PASSWORD@TARGET -windows-auth

MSSQL 关键利用路径:

  • xp_cmdshell / OLE / Agent Job RCE
  • CLR Assembly 攻击
  • 文件读写
  • NTLM Hash 窃取

→ 信息收集 / 提权方法论 → references/mssql-attack.md

MySQL 速查

MySQL 关键利用路径:

  • UDF 提权 / 文件读写