
Analyzing Ethereum Smart Contract Vulnerabilities
- 320 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Guide systematic review of Ethereum smart contracts for common vulnerability classes before mainnet deploy or audit handoff.
About
Analyzing Ethereum Smart Contract Vulnerabilities is an agent skill for solo Web3 builders who must sanity-check Solidity before users’ funds are at risk. It packages cybersecurity-oriented procedural knowledge so Claude Code, Cursor, or similar agents can walk through vulnerability classes, dangerous patterns, and review checkpoints instead of improvising generic security advice. Use it when a contract is feature-complete but not yet blessed for mainnet—after local tests, alongside formal audits, or when validating a forked DeFi component. The skill emphasizes structured analysis over exploit scripting, helping indies who ship alone catch classic issues early. Prism lists it under Ship security with secondary Validate scope when you prototype on testnets and want the same rigor before scaling scope.
- Ethereum-focused smart contract vulnerability analysis workflow
- Fits Anthropic cybersecurity skills collection for agent-assisted review
- Supports pre-deploy and audit-prep security passes on Solidity ecosystems
- Apache 2.0 licensed skill package for reuse in agent tooling
- Checker-style guidance for systematic flaw categories rather than ad-hoc chat
Analyzing Ethereum Smart Contract Vulnerabilities by the numbers
- 320 all-time installs (skills.sh)
- +20 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #64 of 479 Web3 & Blockchain skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-ethereum-smart-contract-vulnerabilitiesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 320 |
|---|---|
| repo stars | ★ 27.3k |
| Security audit | 2 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
What it does
Guide systematic review of Ethereum smart contracts for common vulnerability classes before mainnet deploy or audit handoff.
Files
Analyzing Ethereum Smart Contract Vulnerabilities
Overview
Smart contract vulnerabilities have led to billions of dollars in losses across DeFi protocols. Unlike traditional software, deployed smart contracts are immutable and handle real financial assets, making pre-deployment security analysis critical. Slither performs fast static analysis using an intermediate representation to detect over 90 vulnerability patterns in seconds, while Mythril uses symbolic execution and SMT solving to discover complex execution path vulnerabilities like reentrancy and integer overflows. This skill covers running both tools against Solidity contracts, interpreting results, triaging findings by severity, and generating audit reports.
When to Use
- When investigating security incidents that require analyzing ethereum smart contract vulnerabilities
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Python 3.10+ with pip
- Slither (pip install slither-analyzer) and solc compiler
- Mythril (pip install mythril) with solc-select for compiler version management
- Solidity source code or compiled contract bytecode
- Foundry or Hardhat development framework (optional, for project-level analysis)
Steps
Step 1: Run Slither Static Analysis
Execute Slither against the contract codebase to identify vulnerability patterns, optimization opportunities, and code quality issues using its 90+ built-in detectors.
Step 2: Run Mythril Symbolic Execution
Run Mythril deep analysis to explore execution paths and discover reentrancy, unchecked external calls, and arithmetic vulnerabilities that require path-sensitive analysis.
Step 3: Triage and Correlate Findings
Combine results from both tools, deduplicate findings, assess severity based on exploitability and financial impact, and filter false positives.
Step 4: Generate Audit Report
Produce a structured audit report with vulnerability descriptions, affected code locations, exploit scenarios, and remediation recommendations.
Expected Output
JSON report listing vulnerabilities with SWC (Smart Contract Weakness Classification) identifiers, severity ratings, affected functions, and suggested fixes.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: Analyzing Ethereum Smart Contract Vulnerabilities
Slither CLI
# Basic analysis
slither contracts/
# JSON output
slither contracts/ --json slither-report.json
# Run specific detector only
slither contracts/ --detect reentrancy-eth,unprotected-upgrade
# List all detectors
slither --list-detectors
# Print contract summary
slither contracts/ --print human-summary
# Generate inheritance graph
slither contracts/ --print inheritance-graphMythril CLI
# Analyze single contract
myth analyze contracts/Token.sol
# JSON output
myth analyze contracts/Token.sol -o json
# Set execution timeout
myth analyze contracts/Token.sol --execution-timeout 300
# Analyze deployed bytecode
myth analyze --address 0x1234... --rpc infura
# Increase analysis depth
myth analyze contracts/Token.sol --max-depth 50 --transaction-count 3Slither Detector Severity Levels
| Impact | Confidence | Example Detectors |
|---|---|---|
| High | High | reentrancy-eth, suicidal, arbitrary-send-eth |
| High | Medium | controlled-delegatecall, reentrancy-no-eth |
| Medium | High | locked-ether, incorrect-equality |
| Medium | Medium | uninitialized-state, shadowing-state |
| Low | High | naming-convention, solc-version |
| Informational | High | pragma, dead-code |
SWC Registry (Key Entries)
| SWC ID | Title | Tool Coverage |
|---|---|---|
| SWC-101 | Integer Overflow/Underflow | Mythril |
| SWC-104 | Unchecked Call Return | Slither + Mythril |
| SWC-106 | Unprotected SELFDESTRUCT | Slither + Mythril |
| SWC-107 | Reentrancy | Slither + Mythril |
| SWC-110 | Assert Violation | Mythril |
| SWC-112 | Delegatecall to Untrusted Callee | Slither |
| SWC-115 | tx.origin Authentication | Slither |
| SWC-116 | Block Timestamp Dependence | Mythril |
| SWC-120 | Weak Randomness | Slither |
Installation
# Slither (requires solc)
pip install slither-analyzer
solc-select install 0.8.20
solc-select use 0.8.20
# Mythril
pip install mythrilSlither JSON Output Structure
{
"success": true,
"results": {
"detectors": [{
"check": "reentrancy-eth",
"impact": "High",
"confidence": "Medium",
"description": "Reentrancy in Contract.withdraw()",
"elements": [{"source_mapping": {"filename_short": "Contract.sol", "lines": [42, 43]}}]
}]
}
}References
- Slither: https://github.com/crytic/slither
- Mythril: https://github.com/Consensys/mythril
- SWC Registry: https://swcregistry.io/
- Solidity Security: https://docs.soliditylang.org/en/latest/security-considerations.html
#!/usr/bin/env python3
"""Smart Contract Security Agent - runs Slither and Mythril analysis on Solidity contracts."""
import json
import argparse
import logging
import subprocess
from collections import defaultdict
from datetime import datetime
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
logger = logging.getLogger(__name__)
SWC_REGISTRY = {
"SWC-101": "Integer Overflow and Underflow",
"SWC-104": "Unchecked Call Return Value",
"SWC-106": "Unprotected SELFDESTRUCT",
"SWC-107": "Reentrancy",
"SWC-110": "Assert Violation",
"SWC-112": "Delegatecall to Untrusted Callee",
"SWC-113": "DoS with Failed Call",
"SWC-115": "Authorization through tx.origin",
"SWC-116": "Block values as a proxy for time",
"SWC-120": "Weak Sources of Randomness",
}
def run_slither(contract_path):
"""Run Slither static analysis on Solidity contract."""
cmd = ["slither", contract_path, "--json", "-"]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
try:
return json.loads(result.stdout) if result.stdout else {}
except json.JSONDecodeError:
logger.error("Slither JSON parse failed")
return {}
def run_mythril(contract_path, timeout=300):
"""Run Mythril symbolic execution analysis."""
cmd = ["myth", "analyze", contract_path, "--execution-timeout", str(timeout), "-o", "json"]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout + 60)
try:
return json.loads(result.stdout) if result.stdout else {}
except json.JSONDecodeError:
logger.error("Mythril JSON parse failed")
return {}
def analyze_slither_results(slither_output):
"""Parse and categorize Slither detector findings."""
findings = []
by_severity = defaultdict(int)
by_detector = defaultdict(int)
for detector in slither_output.get("results", {}).get("detectors", []):
severity = detector.get("impact", "informational").lower()
by_severity[severity] += 1
det_name = detector.get("check", "unknown")
by_detector[det_name] += 1
elements = detector.get("elements", [])
location = ""
if elements:
elem = elements[0]
location = f"{elem.get('source_mapping', {}).get('filename_short', '')}:" \
f"L{elem.get('source_mapping', {}).get('lines', [0])[0] if elem.get('source_mapping', {}).get('lines') else 0}"
findings.append({
"detector": det_name,
"severity": severity,
"description": detector.get("description", "")[:200],
"location": location,
"confidence": detector.get("confidence", ""),
})
return {
"total": len(findings),
"by_severity": dict(by_severity),
"by_detector": dict(sorted(by_detector.items(), key=lambda x: x[1], reverse=True)[:15]),
"findings": sorted(findings, key=lambda x: {"high": 0, "medium": 1, "low": 2, "informational": 3}.get(x["severity"], 4)),
}
def analyze_mythril_results(mythril_output):
"""Parse Mythril symbolic execution findings."""
findings = []
by_swc = defaultdict(int)
for issue in mythril_output.get("issues", []):
swc_id = issue.get("swc-id", "")
swc_key = f"SWC-{swc_id}" if swc_id else "unknown"
by_swc[swc_key] += 1
severity = issue.get("severity", "Medium").lower()
findings.append({
"swc_id": swc_key,
"swc_title": SWC_REGISTRY.get(swc_key, issue.get("title", "")),
"severity": severity,
"description": issue.get("description", "")[:200],
"contract": issue.get("contract", ""),
"function": issue.get("function", ""),
"line_number": issue.get("lineno", 0),
})
return {
"total": len(findings),
"by_swc": dict(by_swc),
"findings": findings,
}
def deduplicate_findings(slither_findings, mythril_findings):
"""Merge and deduplicate findings from both tools."""
combined = []
seen = set()
for f in slither_findings.get("findings", []):
key = (f.get("location", ""), f.get("detector", ""))
if key not in seen:
seen.add(key)
combined.append({**f, "source": "slither"})
for f in mythril_findings.get("findings", []):
key = (f.get("contract", "") + str(f.get("line_number", 0)), f.get("swc_id", ""))
if key not in seen:
seen.add(key)
combined.append({**f, "source": "mythril"})
return combined
def generate_report(contract_path, slither_analysis, mythril_analysis, combined):
critical_high = sum(1 for f in combined if f.get("severity") in ("high", "critical"))
return {
"timestamp": datetime.utcnow().isoformat(),
"contract": contract_path,
"slither_analysis": {
"total_findings": slither_analysis["total"],
"by_severity": slither_analysis["by_severity"],
"top_detectors": slither_analysis["by_detector"],
},
"mythril_analysis": {
"total_findings": mythril_analysis["total"],
"by_swc": mythril_analysis["by_swc"],
},
"combined_findings": len(combined),
"critical_high_findings": critical_high,
"audit_result": "FAIL" if critical_high > 0 else "PASS",
"findings": combined[:30],
}
def main():
parser = argparse.ArgumentParser(description="Solidity Smart Contract Security Analysis Agent")
parser.add_argument("--contract", required=True, help="Path to Solidity contract or project directory")
parser.add_argument("--mythril-timeout", type=int, default=300, help="Mythril execution timeout (seconds)")
parser.add_argument("--skip-mythril", action="store_true", help="Skip Mythril (slow symbolic execution)")
parser.add_argument("--output", default="smart_contract_audit_report.json")
args = parser.parse_args()
slither_output = run_slither(args.contract)
slither_analysis = analyze_slither_results(slither_output)
mythril_analysis = {"total": 0, "by_swc": {}, "findings": []}
if not args.skip_mythril:
mythril_output = run_mythril(args.contract, args.mythril_timeout)
mythril_analysis = analyze_mythril_results(mythril_output)
combined = deduplicate_findings(slither_analysis, mythril_analysis)
report = generate_report(args.contract, slither_analysis, mythril_analysis, combined)
with open(args.output, "w") as f:
json.dump(report, f, indent=2, default=str)
logger.info("Smart contract audit: %d findings (%d critical/high), result: %s",
report["combined_findings"], report["critical_high_findings"], report["audit_result"])
print(json.dumps(report, indent=2, default=str))
if __name__ == "__main__":
main()
Related skills
FAQ
Is Analyzing Ethereum Smart Contract Vulnerabilities safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.