Proposes secure remediation strategies for detected security vulnerabilities including buffer overflows, injection risks, insecure deserialization, improper authentication, and unsafe cryptographic usage. Provides recommended security checks, safer API alternatives, design-level changes, code examples, trade-off analysis, and prioritized remediation plans. Does NOT automatically modify code unless explicitly requested.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill security-patch-advisor
This skill analyzes security vulnerabilities and provides comprehensive remediation strategies without automatically modifying code. It offers multiple remediation approaches with detailed trade-off analysis, code examples, and implementation guidance for vulnerabilities categorized by CWE (Common Weakness Enumeration) and severity.
Use this skill when you need:
Trigger scenarios:
When presented with a security vulnerability, analyze:
Context Gathering:
Questions to Consider:
Provide multiple remediation approaches:
Strategy Components:
For Each Strategy, Include:
Provide concrete before/after examples:
Example Structure:
### Vulnerable Code
[Show the insecure code with clear vulnerability markers]
**Vulnerability:** CWE-XXX (Name)
**Risk:** [Explain the security risk]
**Attack Example:** [Show how it could be exploited]
### Remediated Code (Approach 1)
[Show the fixed code with security improvements]
**Changes:**
- [List specific changes made]
- [Explain security mechanisms added]
**Trade-offs:**
- ✅ [Benefits]
- ⚠️ [Limitations or considerations]
### Alternative Remediation (Approach 2)
[Show alternative fix if applicable]
**Trade-offs:**
- ✅ [Benefits]
- ⚠️ [Limitations or considerations]
Provide step-by-step implementation instructions:
Guidance Should Include:
Help prioritize remediation efforts:
Prioritization Factors:
Priority Levels:
Common Remediations:
strncpy, snprintf)Common Remediations:
Common Remediations:
Common Remediations:
Common Remediations:
Common Remediations:
Common Remediations:
Structure your remediation advice as follows:
## Vulnerability Summary
- **Type:** [CWE-XXX: Name]
- **Severity:** [Critical/High/Medium/Low]
- **Location:** [File:Line or Component]
- **Impact:** [Brief description of security impact]
## Risk Analysis
[Explain the security risk, attack vectors, and potential impact]
## Recommended Remediation (Primary)
[Detailed description of the recommended fix]
### Code Example
[Before/after code showing the fix]
### Implementation Steps
1. [Step 1]
2. [Step 2]
...
### Trade-offs
- ✅ [Benefits]
- ⚠️ [Considerations]
## Alternative Approaches
### Alternative 1: [Name]
[Description and code example]
**Trade-offs:**
- ✅ [Benefits]
- ⚠️ [Considerations]
### Alternative 2: [Name]
[Description and code example]
**Trade-offs:**
- ✅ [Benefits]
- ⚠️ [Considerations]
## Design-Level Improvements
[Architectural or system-level changes to consider]
## Verification & Testing
[How to verify the fix and test for regressions]
## Priority Recommendation
**Priority Level:** [P0/P1/P2/P3]
**Rationale:** [Why this priority level]
**Timeline:** [Suggested remediation timeline]
## Additional Resources
[Links to relevant security standards, documentation, or tools]
User: "I found a SQL injection vulnerability in our login function. Here's the code: query = "SELECT * FROM users WHERE username = '" + username + "'""
Response:
## Vulnerability Summary
- **Type:** CWE-89: SQL Injection
- **Severity:** Critical
- **Location:** Login function
- **Impact:** Attackers can bypass authentication, extract database contents, or modify data
## Risk Analysis
The login function constructs SQL queries using string concatenation with user-supplied input. An attacker can inject SQL commands by providing specially crafted input like `' OR '1'='1` to bypass authentication or `'; DROP TABLE users; --` to execute destructive commands.
## Recommended Remediation (Parameterized Queries)
Use parameterized queries (prepared statements) to separate SQL logic from data:
### Code Example
**Vulnerable Code:**
query = "SELECT * FROM users WHERE username = '" + username + "'"
cursor.execute(query)
**Remediated Code:**
query = "SELECT * FROM users WHERE username = ?"
cursor.execute(query, (username,))
### Implementation Steps
1. Replace string concatenation with parameterized query syntax
2. Pass user input as tuple parameter to `execute()`
3. Test with various inputs including SQL injection attempts
4. Verify query logs show parameterized queries
### Trade-offs
- ✅ Complete protection against SQL injection
- ✅ No performance impact
- ✅ Minimal code changes
- ✅ Database driver handles escaping automatically
- ⚠️ Requires understanding of parameterized query syntax
## Alternative Approaches
### Alternative 1: ORM Framework
Use an Object-Relational Mapping framework:
user = User.query.filter_by(username=username).first()
**Trade-offs:**
- ✅ Even simpler code
- ✅ Built-in injection protection
- ✅ Abstraction from SQL details
- ⚠️ Requires ORM framework (SQLAlchemy, Django ORM)
- ⚠️ May have performance overhead for complex queries
- ⚠️ Learning curve for ORM concepts
### Alternative 2: Stored Procedures
Encapsulate SQL logic in stored procedures:
cursor.callproc('sp_authenticate_user', (username,))
**Trade-offs:**
- ✅ Centralized SQL logic
- ✅ Parameterized by default
- ✅ Can enforce additional security policies
- ⚠️ Requires database-side development
- ⚠️ Less flexible for dynamic queries
- ⚠️ Harder to version control
## Design-Level Improvements
1. **Input Validation:** Implement whitelist validation for usernames (alphanumeric only)
2. **Rate Limiting:** Add rate limiting to prevent brute force attacks
3. **Logging:** Log all authentication attempts for security monitoring
4. **MFA:** Consider implementing multi-factor authentication
## Verification & Testing
1. **Positive Test:** Verify legitimate logins still work
2. **Injection Test:** Try inputs like `' OR '1'='1`, `'; DROP TABLE users; --`
3. **Query Inspection:** Check database logs to confirm parameterized queries
4. **Automated Testing:** Add security test cases to test suite
## Priority Recommendation
**Priority Level:** P0 (Critical)
**Rationale:** SQL injection in authentication is critical severity, allows complete system compromise
**Timeline:** Fix immediately (within 24 hours)
## Additional Resources
- OWASP SQL Injection Prevention Cheat Sheet
- CWE-89: SQL Injection
- Database-specific parameterized query documentation
Comprehensive remediation patterns organized by vulnerability category, including:
Complete before/after remediation examples with detailed explanations:
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.
You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.
Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges
This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.
Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.
This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.
Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.
Take arabelatso/security-patch-advisor from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.