scanning-database-security
Process use when you need to work with security and compliance. This skill provides security scanning and vulnerability detection with comprehensive guidance and automation. Trigger with phrases like "scan for vulnerabilities", "implement security controls", or "audit security".
Best use case
scanning-database-security is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Process use when you need to work with security and compliance. This skill provides security scanning and vulnerability detection with comprehensive guidance and automation. Trigger with phrases like "scan for vulnerabilities", "implement security controls", or "audit security".
Teams using scanning-database-security should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/scanning-database-security/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How scanning-database-security Compares
| Feature / Agent | scanning-database-security | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Process use when you need to work with security and compliance. This skill provides security scanning and vulnerability detection with comprehensive guidance and automation. Trigger with phrases like "scan for vulnerabilities", "implement security controls", or "audit security".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Database Security Scanner
## Overview
Audit database security configurations, user privileges, network exposure, and data protection controls for PostgreSQL, MySQL, and MongoDB. This skill scans for common vulnerabilities including excessive privileges, missing encryption, default passwords, exposed network ports, unpatched versions, and SQL injection vectors in application code.
## Prerequisites
- Database admin credentials for querying system catalogs and security settings
- `psql`, `mysql`, or `mongosh` CLI tools installed
- Access to database configuration files (`postgresql.conf`, `pg_hba.conf`, `my.cnf`, `mongod.conf`)
- Application source code access for SQL injection scanning (using Grep/Glob tools)
- Knowledge of applicable compliance frameworks (SOC 2, HIPAA, PCI-DSS, GDPR)
## Instructions
1. Check authentication configuration by reviewing `pg_hba.conf` (PostgreSQL) or `mysql.user` table. Flag any entries using `trust` authentication, allowing connections without passwords. Verify `password_encryption = scram-sha-256` (not `md5`) in PostgreSQL.
2. Audit user privileges by querying role memberships and grants:
- PostgreSQL: `SELECT r.rolname, r.rolsuper, r.rolinherit, r.rolcreaterole, r.rolcreatedb FROM pg_roles r WHERE r.rolcanlogin = true`
- MySQL: `SELECT user, host, Super_priv, Grant_priv, File_priv FROM mysql.user`
- Flag users with superuser/SUPER privilege, excessive grants, or `GRANT OPTION`
3. Scan for default or weak credentials. Check for accounts with no password: PostgreSQL `SELECT rolname FROM pg_roles WHERE rolpassword IS NULL AND rolcanlogin = true`. Check for well-known default accounts (postgres with default password, root without password, admin/admin).
4. Verify network security:
- Check `listen_addresses` in postgresql.conf (should not be `*` in production without firewall)
- Verify SSL/TLS is enforced: `SHOW ssl` should return `on`; `pg_hba.conf` should use `hostssl` instead of `host`
- Confirm database port is not exposed to the public internet
5. Check encryption at rest:
- Verify tablespace encryption or volume-level encryption is enabled
- Scan for sensitive data stored in plaintext: `SELECT column_name, data_type FROM information_schema.columns WHERE column_name ILIKE '%password%' OR column_name ILIKE '%ssn%' OR column_name ILIKE '%credit_card%'`
- Flag columns storing PII without encryption or hashing
6. Scan application source code for SQL injection vulnerabilities using Grep:
- Search for string concatenation in SQL queries: patterns like `"SELECT * FROM " + variable` or Python f-strings with interpolated table names
- Search for missing parameterized queries: raw SQL construction without bind parameters
- Flag ORM `raw()` or `execute()` calls with string interpolation
7. Review database object permissions:
- Check for PUBLIC grants on sensitive tables: `SELECT grantee, table_name, privilege_type FROM information_schema.table_privileges WHERE grantee = 'PUBLIC'`
- Verify functions are created with `SECURITY DEFINER` only when necessary
- Check for world-readable backup files on the filesystem
8. Audit logging configuration:
- Verify `log_connections = on`, `log_disconnections = on` in PostgreSQL
- Check `log_statement = 'ddl'` or `'all'` for sensitive databases
- Confirm audit logs are shipped to a tamper-proof location
9. Check for known CVEs by comparing the database version against the latest security advisories. Flag databases running versions with known critical vulnerabilities.
10. Generate a security findings report with severity levels (Critical, High, Medium, Low), affected components, evidence (query output showing the vulnerability), and specific remediation commands.
## Output
- **Security findings report** with severity-ranked vulnerabilities and evidence
- **Remediation scripts** (SQL) for revoking excessive privileges, fixing authentication, enabling SSL
- **Hardened configuration templates** for postgresql.conf, pg_hba.conf, or my.cnf
- **SQL injection findings** listing vulnerable code locations with fix suggestions
- **Compliance checklist** mapping findings to SOC 2, HIPAA, or PCI-DSS controls
## Error Handling
| Error | Cause | Solution |
|-------|-------|---------|
| Permission denied querying pg_roles or mysql.user | Scanner account lacks privilege to read user metadata | Grant `pg_read_all_settings` and `pg_read_all_stats` roles; or run scan with superuser credentials in a controlled session |
| Cannot access postgresql.conf from SQL | File-system access restricted; `pg_file_settings` view not available | Use `SHOW ALL` to check runtime settings; request file access from ops team; use `pg_settings` catalog view |
| SSL certificate errors during scan | Self-signed certificates or expired certificates on database | Note as a finding; generate new certificates with `openssl`; configure `ssl_cert_file` and `ssl_key_file` |
| Source code scan produces false positives | Dynamic SQL construction that uses proper parameterization | Review flagged locations manually; whitelist confirmed-safe patterns; focus on string concatenation with user input |
| Database version check shows EOL version | Database version no longer receiving security patches | Prioritize as critical finding; plan upgrade path; apply last available patches as interim measure |
## Examples
**PostgreSQL security audit revealing over-privileged roles**: Scan discovers 5 application users with `SUPERUSER` privilege, `pg_hba.conf` using `trust` for local connections, and SSL disabled. Remediation: revoke SUPERUSER, create application-specific roles with minimum privileges, switch to `scram-sha-256` authentication, and enable SSL with Let's Encrypt certificates.
**SQL injection scan of a Node.js application**: Grep finds 12 instances of `db.query("SELECT * FROM users WHERE id = " + req.params.id)` across 4 files. Remediation: replace with parameterized queries `db.query("SELECT * FROM users WHERE id = $1", [req.params.id])`. Each finding includes file path, line number, and corrected code.
**PCI-DSS compliance check for payment database**: Scan verifies: credit card numbers stored as hashed values (pass), audit logging enabled for cardholder data tables (pass), database admin accounts shared among team members (fail - individual accounts required), backups unencrypted on S3 (fail - enable SSE-S3). Produces compliance gap report with remediation timeline.
## Resources
- CIS PostgreSQL Benchmark: https://www.cisecurity.org/benchmark/postgresql
- CIS MySQL Benchmark: https://www.cisecurity.org/benchmark/oracle_mysql
- PostgreSQL security documentation: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
- OWASP SQL Injection Prevention: https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html
- Database security checklist: https://www.postgresql.org/docs/current/auth-methods.htmlRelated Skills
scanning-for-xss-vulnerabilities
This skill enables Claude to automatically scan for XSS (Cross-Site Scripting) vulnerabilities in code. It is triggered when the user requests to "scan for XSS vulnerabilities", "check for XSS", or uses the command "/xss". The skill identifies reflected, stored, and DOM-based XSS vulnerabilities. It analyzes HTML, JavaScript, CSS, and URL contexts to detect potential exploits and suggests safe proof-of-concept payloads. This skill is best used during code review, security audits, and before deploying web applications to production.
validating-database-integrity
Process use when you need to ensure database integrity through comprehensive data validation. This skill validates data types, ranges, formats, referential integrity, and business rules. Trigger with phrases like "validate database data", "implement data validation rules", "enforce data integrity constraints", or "validate data formats".
checking-session-security
This skill enables Claude to check session security implementations within a codebase. It analyzes session management practices to identify potential vulnerabilities. Use this skill when a user requests to "check session security", "audit session handling", "review session implementation", or asks about "session security best practices" in their code. It helps identify issues like insecure session IDs, lack of proper session expiration, or insufficient protection against session fixation attacks. This skill leverages the session-security-checker plugin. Activates when you request "checking session security" functionality.
performing-security-testing
This skill automates security vulnerability testing. It is triggered when the user requests security assessments, penetration tests, or vulnerability scans. The skill covers OWASP Top 10 vulnerabilities, SQL injection, XSS, CSRF, authentication issues, and authorization flaws. Use this skill when the user mentions "security test", "vulnerability scan", "OWASP", "SQL injection", "XSS", "CSRF", "authentication", or "authorization" in the context of application or API testing.
performing-security-audits
This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.
security-policy-generator
Security Policy Generator - Auto-activating skill for Security Advanced. Triggers on: security policy generator, security policy generator Part of the Security Advanced skill category.
finding-security-misconfigurations
This skill enables Claude to identify potential security misconfigurations in various systems and configurations. It leverages the security-misconfiguration-finder plugin to analyze infrastructure-as-code, application configurations, and system settings, pinpointing common vulnerabilities and compliance issues. Use this skill when the user asks to "find security misconfigurations", "check for security vulnerabilities in my configuration", "audit security settings", or requests a security assessment of a specific system or file. This skill will assist in identifying and remediating potential security weaknesses.
responding-to-security-incidents
Assists with security incident response, investigation, and remediation. This skill is triggered when the user requests help with incident response, mentions specific incident types (e.g., data breach, ransomware, DDoS), or uses terms like "incident response plan", "containment", "eradication", or "post-incident activity". It guides the user through the incident response lifecycle, from preparation to post-incident analysis. It is useful for classifying incidents, creating response playbooks, collecting evidence, constructing timelines, and generating remediation steps. Use this skill when needing to respond to a "security incident".
security-headers-generator
Security Headers Generator - Auto-activating skill for Security Fundamentals. Triggers on: security headers generator, security headers generator Part of the Security Fundamentals skill category.
analyzing-security-headers
This skill analyzes HTTP security headers of a given domain to identify potential vulnerabilities and misconfigurations. It provides a detailed report with a grade, score, and recommendations for improvement. Use this skill when the user asks to "analyze security headers", "check HTTP security", "scan for security vulnerabilities", or requests a "security audit" of a website. It will automatically activate when security-related keywords are used in conjunction with domain names or URLs.
security-group-generator
Security Group Generator - Auto-activating skill for AWS Skills. Triggers on: security group generator, security group generator Part of the AWS Skills skill category.
security-benchmark-runner
Security Benchmark Runner - Auto-activating skill for Security Advanced. Triggers on: security benchmark runner, security benchmark runner Part of the Security Advanced skill category.