reentrancy
यह क्या करती है
यह प्लेबुक स्मार्ट कॉन्ट्रैक्ट में reentrancy कमज़ोरियों की खोज का मार्गदर्शन करती है। यह उन ऑडिटरों और डेवलपर्स के लिए है जो हर जोखिम भरी बाहरी कॉल की सुरक्षा पक्की करना चाहते हैं।
कब इस्तेमाल करें
- ✓जब कोई कॉन्ट्रैक्ट ऐसी बाहरी कॉल करता है जो मूल्य भेजती है या state बदलती है।
- ✓जब किसी कॉन्ट्रैक्ट के कई फ़ंक्शन एक ही storage साझा करते हैं।
- ✓जब कोई read-only फ़ंक्शन किसी कॉल के दौरान पुराने मान लौटा सकता है।
Skill का लिंक
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/reentrancy/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप हमारे vault कॉन्ट्रैक्ट में reentrancy बग जाँच सकते हैं और पुष्टि कर सकते हैं कि withdraw फ़ंक्शन सुरक्षित है?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट बाहरी कॉल खोजता है, जाँचता है कि state बदलाव उनसे पहले होते हैं या नहीं और reentrancy guard लगा है या नहीं, फिर परिणाम का टेस्ट करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Reentrancy Playbook
Variants
- Classic — external call before state update (The DAO)
- Cross-function — A calls out, reentered into B which reads/writes A's state
- Read-only — view function reads stale state during reentrancy, consumed by a second contract making decisions
- Cross-contract — same attack pattern across protocol boundaries
- ERC777 / ERC1155 hook —
onERC*Receivedcallback re-enters
Audit steps
solidity_scan_fileflags every.call{value:...}anddelegatecall- For each hit, check:
- Is there a state write BEFORE the external call?
- Is
ReentrancyGuard'snonReentrantmodifier applied? - Does it follow checks-effects-interactions?
- Trace call graph — if any function the call target can invoke reads or writes the same state slot, that's a reentrancy chain.
PoC via Foundry
foundry_reentrancy_test(target="Vault", function="withdraw", target_path="src/Vault.sol")
Then:
cp generated.t.sol /workspace/foundry/test/
cd /workspace/foundry && forge test -vvv --match-contract Test_withdraw
Success criteria
The attacker contract balance grows by more than its initial deposit after the attack transaction. The Foundry test should assert this.
CVSS
- Direct fund drain:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H= 10.0 - Read-only with downstream impact: 8.1-9.1 depending on impact
Known exemplars
- The DAO (2016)
- Lendf.Me (2020, ERC777 hook reentrancy, $25M)
- Cream Finance (2021)
- Rari Capital (2022)
- Curve pool read-only reentrancy (2023)
अक्सर पूछे जाने वाले सवाल
क्लासिक समाधान क्या है?
बाहरी कॉल से पहले state अपडेट करना, यानी checks, effects, फिर interactions का पैटर्न।
read-only reentrancy क्या है?
कॉल के दौरान कोई view फ़ंक्शन पुराने मान लौटा सकता है, और दूसरा कॉन्ट्रैक्ट उन पर निर्भर हो सकता है।
खोज की पुष्टि कैसे होती है?
Foundry टेस्ट से, जो जाँचता है कि कॉन्ट्रैक्ट का balance जमा से ज़्यादा तो नहीं बढ़ता।
जानकारी
लेखक का मूल विवरण
Hunt and validate reentrancy bugs — classic cross-function, same-function, read-only, and cross-contract variants.
लोकप्रियता
- GitHub स्टार
- 6.5k
- रैंकिंग में स्थान
- #14011
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
detector-overview
6.5kयह आपके एजेंट को स्कैनर से चिह्नित कोड पढ़ने और तय करने में मदद करती है कि कौन सी जगहें असली सुरक्षा बग हैं और कौन सी गलत चेतावनी।
exploiter-overview
6.5kयह आपके एजेंट को कई पक्की सुरक्षा कमज़ोरियों को एक परीक्षण श्रृंखला में जोड़ने और जाँचने में मदद करती है कि वह श्रृंखला कितनी दूर तक पहुँच सकती है।
llm-redteam-overview
6.5kयह आपके एजेंट को परीक्षण के लिए सही AI रेड-टीम गाइड खोजने में मदद करती है, प्रॉम्प्ट इंजेक्शन से लेकर मॉडल के दुरुपयोग तक 15 रणनीति समूहों में।
aatmf-t01-prompt-injection
6.5kसमझाती है कि प्रॉम्प्ट इंजेक्शन क्या है, जिसमें छिपे निर्देश AI सिस्टम के नियम बदलने की कोशिश करते हैं, ताकि सुरक्षा परीक्षक उसकी जाँच कर सकें।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।