Fähigkeiten solidity-security
🔒

solidity-security

Sicher

Secure Smart Contract Development

Auch verfügbar von: wshobson

Prevent costly vulnerabilities in your Solidity code. This skill provides proven security patterns, vulnerability detection checklists, and gas optimization techniques used by professional auditors to protect DeFi protocols and smart contracts.

Unterstützt: Claude Codex Code(CC)
🥉 75 Bronze
1

Die Skill-ZIP herunterladen

2

In Claude hochladen

Gehe zu Einstellungen → Fähigkeiten → Skills → Skill hochladen

3

Einschalten und loslegen

Teste es

Verwendung von "solidity-security". Is this withdraw function secure? function withdraw() public { uint256 amount = balances[msg.sender]; payable(msg.sender).transfer(amount); balances[msg.sender] = 0; }

Erwartetes Ergebnis:

This function is VULNERABLE to reentrancy. The external call happens before the state update. An attacker can recursively call withdraw before the balance is set to zero. FIX: Apply Checks-Effects-Interactions pattern: first set balances[msg.sender] = 0, then make the external call. Alternatively, use OpenZeppelin's ReentrancyGuard with the nonReentrant modifier.

Verwendung von "solidity-security". How do I add access control to my admin-only function?

Erwartetes Ergebnis:

Import OpenZeppelin's Ownable contract and use the onlyOwner modifier. Alternatively, implement role-based access with a mapping and custom modifier. Ensure the function validates msg.sender is authorized before executing sensitive operations.

Sicherheitsaudit

Sicher
v1 • 2/25/2026

All 72 static analysis findings are false positives. The detected patterns (shell backticks, dynamic requires, weak cryptography) exist within markdown code blocks demonstrating Solidity security concepts and JavaScript testing examples. This skill contains only educational documentation with no executable code. The skill legitimately teaches smart contract security best practices including reentrancy prevention, access control, and gas optimization.

2
Gescannte Dateien
562
Analysierte Zeilen
0
befunde
1
Gesamtzahl Audits
Keine Sicherheitsprobleme gefunden
Auditiert von: claude

Qualitätsbewertung

38
Architektur
100
Wartbarkeit
87
Inhalt
50
Community
100
Sicherheit
100
Spezifikationskonformität

Was du bauen kannst

Building a DeFi Protocol

Implement secure lending, borrowing, or exchange contracts with proper reentrancy guards and access control.

Auditing Smart Contracts

Review existing contracts for vulnerabilities before mainnet deployment or integration.

Learning Solidity Security

Understand common attack vectors and proven mitigation patterns for secure development.

Probiere diese Prompts

Basic Security Check
Review my Solidity contract for common vulnerabilities including reentrancy, overflow, and access control issues. Point out any insecure patterns and suggest fixes.
Implement Reentrancy Protection
Help me add reentrancy protection to my withdraw function. Show me both the Checks-Effects-Interactions pattern and the OpenZeppelin ReentrancyGuard approach.
Gas Optimization
Analyze my contract for gas optimization opportunities. Focus on storage packing, calldata usage, and reducing redundant operations while maintaining security.
Audit Preparation
Review my contract for audit readiness. Check for NatSpec documentation, input validation, emergency stop mechanisms, and proper event emission. Create a security checklist.

Bewährte Verfahren

  • Always apply Checks-Effects-Interactions pattern: validate inputs, update state, then make external calls
  • Use OpenZeppelin's audited contracts for ReentrancyGuard, Ownable, and Pausable instead of custom implementations
  • Enable Solidity 0.8+ for built-in overflow/underflow protection or use SafeMath library for older versions

Vermeiden

  • Never use tx.origin for authentication - it can be phished by malicious contracts
  • Avoid making external calls before updating contract state, as this enables reentrancy attacks
  • Do not use floating pragma - always pin to a specific Solidity version to ensure deterministic compilation

Häufig gestellte Fragen

What is the most common smart contract vulnerability?
Reentrancy is the most common and critical vulnerability. It occurs when external calls are made before state updates, allowing attackers to recursively call functions and drain funds. Always use the Checks-Effects-Interactions pattern or OpenZeppelin's ReentrancyGuard.
Do I need SafeMath with Solidity 0.8+?
No. Solidity 0.8 and later versions include built-in overflow and underflow checks that automatically revert on arithmetic errors. SafeMath is only necessary for contracts using Solidity versions prior to 0.8.
Should I use msg.sender or tx.origin for authentication?
Always use msg.sender for authentication. The tx.origin represents the original sender of the transaction and can be exploited through phishing attacks. Never use tx.origin for authorization checks.
What is the difference between pull and push payment patterns?
Push payments involve the contract sending funds to users, which can fail if users have fallback issues. Pull payments let users withdraw their own funds, which is safer because the user controls the timing. Prefer pull over push for batch distributions.
How do I prepare my contract for a professional audit?
Add comprehensive NatSpec documentation, implement input validation, use access control modifiers, emit events for state changes, write unit tests covering edge cases, and create a security checklist. Ensure no compiler warnings and use fixed pragma versions.
Can this skill replace a professional security audit?
No. This skill helps identify common vulnerabilities and implements best practices, but it does not replace a professional audit. High-value contracts, DeFi protocols, and productions systems require formal verification and human review by security experts.