# pentestwiki.org — full content > Your Penetration Testing Academy for Web2 and Web3 Source: https://pentestwiki.org/ Generated: 2026-11-28T07:12:05+00:00 License note: please attribute pentestwiki.org and link to the source URL when quoting. --- # About pentestwiki.org URL: https://pentestwiki.org/about-us/ pentestwiki.org is a free penetration testing academy for Web2 and Web3, run by practising security professionals. Since 2020 we have published hands-on tutorials, cheat sheets and tools that help people learn offensive security the right way — legally, ethically and in depth. ## Our mission Security knowledge should be practical and accessible. Too much material is either shallow marketing or locked behind expensive courses. We publish the kind of guides we wish we'd had when we started: concrete, tool-driven, and honest about what works, what doesn't, and where the legal and ethical lines are. Our tagline — Your Penetration Testing Academy for Web2 and Web3 — reflects a belief that classic infrastructure and web skills and modern smart-contract security belong in the same curriculum. ## What we do ### Tutorials Step-by-step guides on infrastructure, web, mobile, cloud, red team and blockchain security — every one tested before it's published. ### Cheat sheets & tools Searchable command references and free browser-based utilities that run entirely on your machine. ### Professional services Authorized penetration tests, smart contract audits and training for teams that need an expert assessment. ## Our story - 2020 — pentestwiki.org launches as a small collection of pentesting notes and cheat sheets under the DEFENSAHACKER Academy banner. - 2021 — The library grows into structured learning paths covering infrastructure, web and mobile testing, and a companion quiz app, "Learn Pentesting Like a Pro". - 2022 — We expand into Web3: EVM internals, Solidity auditing with Slither, Surya, Mythril and Foundry, and smart contract security reviews. - Today — A refreshed platform with new in-depth tutorials, interactive tools, and professional audit and training services, still free at its core. ## What we stand for ### Legal & ethical Everything we teach is for authorized testing and defence. We never publish ready-made attack kits, and every offensive technique comes with the context to use it responsibly and the fix that neutralises it. ### Tested, not theoretical We run the tools and commands we write about. If something has caveats or doesn't work as advertised, we say so. ### Kept current Security moves fast. We revisit and update guides as tools and standards evolve, and we date every change. ### For everyone From students preparing for OSCP to developers hardening a smart contract, the material meets you where you are. ## Who writes this Content is produced by the pentestwiki.org editorial team — practising penetration testers, red teamers and smart contract auditors — and peer-reviewed before publication. Our lead author, jacobo, founded the site and DEFENSAHACKER Academy and focuses on Web3 security, Ethereum internals and mobile application security. Read how we research and review in our editorial policy. ## A note on ethics Offensive security is a tool for defence. We assume our readers are testing systems they own or are authorized to assess, students practising in deliberately vulnerable labs, or defenders learning how attacks work so they can stop them. If you're new, start with legal practice environments — intentionally vulnerable apps and CTF platforms — never someone else's systems. Want us to assess your systems? Our team performs authorized penetration tests and smart contract audits. See our services ## Get in touch Questions about a tutorial, a correction, a quote for an audit, or a responsible disclosure? Visit our contact page or email contact@pentestwiki.org. --- # Active Directory Attack Paths with BloodHound: A Red and Blue Team Guide URL: https://pentestwiki.org/red-team/active-directory-attack-paths-bloodhound/ Published: 2026-11-19 | Updated: 2026-11-26 Category: Red Team | Tags: active directory, bloodhound, pentesting, red team BloodHound models Active Directory and Entra ID as a graph, revealing privilege-escalation paths that are invisible in a list of group memberships. It is used by red teams to find routes to high-value targets and by defenders to remove those same routes. This guide explains the data model, authorized collection, the edges that matter, and how blue teams act on the results. Collection touches many systems and is detectable. Run it only inside an engagement with a signed scope and rules of engagement, and inform the SOC when required. A BloodHound attack path from Domain Users to Domain Admins. Source: BloodHoundAD/BloodHound. ## Why a graph? Active Directory privilege is transitive. A user is in a group, that group has rights over a computer, that computer has a logged-on admin, that admin is in another group... Individually each relationship looks benign; chained together they form a path from an ordinary user to Domain Admin. BloodHound uses graph theory to find the shortest such paths automatically. ## Nodes and edges Nodes are objects — Users, Groups, Computers, OUs, GPOs, Domains. Edges are relationships — and the interesting ones are the rights that allow control: EdgeMeaning MemberOfGroup membership (transitive privilege). AdminToPrincipal is local admin on a computer. HasSessionA user has a session on a computer (credential exposure). GenericAll / GenericWriteFull / write control over an object — often a takeover primitive. ForceChangePasswordCan reset another user's password. DCSync (GetChanges/All)Can replicate secrets from the domain controller. ## Authorized data collection SharpHound (or the cross-platform collectors) gathers the data as an authenticated domain user and produces JSON that you import into BloodHound. ``` # Run collection as a domain user within the engagement SharpHound.exe --collectionmethods All --outputdirectory .\loot ``` ``` # Cross-platform collector (Python) bloodhound-python -u user -p 'REDACTED' -d corp.local -c All -ns 10.0.0.10 ``` Default collection performs many LDAP and SMB queries and can be flagged by modern EDR and identity-protection tools. Agree collection method and timing with the client, and prefer targeted methods over All where stealth matters. ## Analysing paths Import the JSON, then use the built-in queries or Cypher. Classic questions: - "Shortest paths to Domain Admins" — the headline attack path. - "Find principals with DCSync rights" — anyone who can dump all hashes. - "Shortest paths from owned principals" — mark what you've compromised and see where it leads. ``` // Example Cypher: users that can reset a Domain Admin's password MATCH p=(u:User)-[:ForceChangePassword]->(a:User)-[:MemberOf*1..]->(g:Group {name:"DOMAIN ADMINS@CORP.LOCAL"}) RETURN p ``` ## The blue-team view The same graph is a remediation tool. Defenders use it to: - Cut the shortest paths first — removing one well-placed edge can break many paths at once. - Review dangerous ACLs — unexpected GenericAll/GenericWrite grants are often misconfigurations. - Reduce admin sprawl — fewer AdminTo and HasSession relationships means fewer credential-theft pivots. - Tier your accounts so that Tier 0 (domain controllers, admins) never logs on to lower tiers. - Re-run collection after changes to confirm the path is gone. Pair BloodHound with detection engineering: alert on SharpHound-like LDAP query bursts and on DCSync from non-DC hosts. The attack paths you can't remove immediately should at least be monitored. ### Key takeaways - AD privilege is transitive; BloodHound finds the chained paths a list of memberships hides. - Edges like GenericAll, ForceChangePassword and DCSync are common takeover primitives. - Collection is noisy and detectable — scope and time it, and inform the SOC when required. - Defenders use the same graph to cut the shortest paths and tier their accounts. ## Frequently asked questions What is BloodHound used for?BloodHound uses graph theory to reveal hidden relationships and privilege escalation paths in Active Directory and Entra ID, helping red teams find paths to high-value targets and blue teams eliminate them. Is SharpHound collection noisy?Default collection performs many LDAP and SMB queries and can be detected by modern EDR and identity protection tools. Agree collection methods and timing with the client and inform the SOC when required by the rules of engagement. --- # Container and Kubernetes Security Scanning with Trivy: Images, IaC, Secrets and SBOMs URL: https://pentestwiki.org/cloud-security/container-security-scanning-with-trivy/ Published: 2026-11-05 | Updated: 2026-11-26 Category: Cloud Security | Tags: cloud, devsecops, docker, kubernetes, trivy Trivy by Aqua Security is a single scanner for container images, filesystems, Git repositories, infrastructure-as-code and Kubernetes clusters. It detects vulnerabilities, misconfigurations, exposed secrets and license issues, and it generates SBOMs. This guide shows how to use it across the software lifecycle and how to gate a CI/CD pipeline on real risk. Trivy, an all-in-one open-source security scanner. Source: aquasecurity/trivy. ## Installation ``` # Script install curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin # Homebrew brew install trivy trivy --version ``` ## Scanning container images ``` # Full image scan trivy image myorg/app:1.4.2 # Only actionable issues: fixable, high/critical trivy image --severity HIGH,CRITICAL --ignore-unfixed myorg/app:1.4.2 # Scan an image tarball built in CI before it is pushed trivy image --input app.tar ``` --ignore-unfixed hides vulnerabilities with no available patch so the team focuses on things it can actually act on. ## Filesystem, repositories and secrets ``` # Scan source code dependencies and secrets together trivy fs --scanners vuln,secret,misconfig . # Scan a remote Git repository trivy repo https://github.com/myorg/service ``` The secret scanner catches API keys and tokens accidentally committed. Add it to a pre-commit hook so secrets are caught before they ever reach the remote. ## Infrastructure as code ``` # Terraform, CloudFormation, Dockerfile, Kubernetes manifests trivy config . # Just the Dockerfile best-practices and misconfig checks trivy config --file-patterns "dockerfile:Dockerfile*" . ``` What Trivy can scan and what it looks for. Source: aquasecurity/trivy. ## Kubernetes ``` # Cluster-wide security report trivy k8s --report summary cluster # A single namespace trivy k8s --report all --namespace production ``` ## SBOMs ``` # Generate a CycloneDX SBOM trivy image --format cyclonedx -o sbom.cdx.json myorg/app:1.4.2 # Later, scan that SBOM for newly disclosed vulnerabilities trivy sbom sbom.cdx.json ``` Keeping SBOMs means you can re-check shipped artifacts against newly disclosed CVEs without rebuilding them. ## Gating CI/CD without breaking builds ``` # Fail the build only on fixable high/critical issues trivy image --exit-code 1 --severity HIGH,CRITICAL --ignore-unfixed myorg/app:1.4.2 ``` Document accepted risks in a .trivyignore file with a reason and a review date: ``` # .trivyignore # Accepted until 2026-09-01 — not reachable in our usage, tracked in TICKET-123 CVE-2025-12345 ``` ### Key takeaways - One tool scans images, filesystems, repos, IaC and Kubernetes. - Use --ignore-unfixed and limit severity so teams act on real, fixable risk. - Add the secret scanner to pre-commit to stop leaks early. - Generate SBOMs so you can re-check shipped artifacts against future CVEs. ## Frequently asked questions What can Trivy scan?Container images, filesystems, Git repositories, virtual machine images, Kubernetes clusters and infrastructure-as-code files, detecting vulnerabilities, misconfigurations, exposed secrets and software licenses. How do I stop Trivy from failing builds on unfixable CVEs?Use --ignore-unfixed, limit --severity to HIGH,CRITICAL, and document accepted risks in a .trivyignore file with justification and review dates. --- # AWS Cloud Security Assessment with Prowler: From Read-Only Credentials to Prioritised Findings URL: https://pentestwiki.org/cloud-security/aws-security-assessment-with-prowler/ Published: 2026-10-22 | Updated: 2026-11-26 Category: Cloud Security | Tags: aws, cis, cloud, pentesting, prowler Prowler is an open-source security tool for assessing cloud environments against benchmarks such as the CIS AWS Foundations. This guide plans a cloud review, creates a least-privilege audit role, runs Prowler against AWS, and turns hundreds of results into a prioritised remediation plan. Run Prowler only against accounts you own or are authorized to assess, with read-only credentials. Even read-only enumeration should be agreed in writing. Prowler findings overview. Source: prowler-cloud/prowler. ## Plan the assessment Decide which accounts and regions are in scope, which framework you are measuring against (CIS, NIST, PCI, your own baseline), and who receives the report. A cloud review is a configuration audit, not an intrusion — the output is a list of misconfigurations ranked by risk. ## Installation ``` # pip (Python 3.9+) pip install prowler prowler --version # or Docker docker run -it --rm toniblyx/prowler:latest aws --help ``` ## Least-privilege audit credentials Prowler needs read and list access. AWS provides two managed policies that cover almost everything: SecurityAudit and ViewOnlyAccess. Create a dedicated role or user with exactly those and nothing more. ``` # Configure a dedicated profile with the audit credentials aws configure --profile audit # Attach SecurityAudit + ViewOnlyAccess to that principal in IAM ``` ## Running Prowler ``` # Full assessment with a named profile prowler aws --profile audit # Measure against a specific benchmark prowler aws --profile audit --compliance cis_3.0_aws # Limit regions and services to keep it focused prowler aws --profile audit --region eu-west-1 --service s3 iam ec2 ``` ## Output and evidence ``` # Machine-readable outputs for the report and for tracking over time prowler aws --profile audit \ --output-formats csv json-ocsf html \ --output-directory ./prowler-out ``` Prowler visualises relationships between findings. Source: prowler-cloud/prowler. ## Turning results into a plan A first run can produce hundreds of findings. Prioritise: - Internet-exposed, high severity first — public S3 buckets, security groups open to 0.0.0.0/0 on sensitive ports, public RDS. - Identity and access — root account usage, missing MFA, over-privileged policies, long-lived access keys. - Logging and detection — CloudTrail disabled in a region, no Config, missing GuardDuty. - Encryption — unencrypted volumes, snapshots and buckets. - Everything else, grouped by service owner so fixes can be delegated. Record accepted risks with justification and a review date. Re-run Prowler after remediation to measure progress — the machine-readable output makes before/after comparison easy. ## Beyond AWS Current Prowler versions include providers for Azure, Google Cloud, Kubernetes and Microsoft 365, each with its own checks and compliance mappings: ``` prowler azure --az-cli-auth prowler gcp --project-ids my-project prowler kubernetes --context my-cluster ``` ### Key takeaways - Use a dedicated role with SecurityAudit + ViewOnlyAccess — nothing more. - Measure against a named benchmark (e.g. CIS) so findings have authority. - Prioritise internet-exposed and identity findings before the long tail. - Save machine-readable output to track remediation over time and across accounts. ## Frequently asked questions Do I need AWS permission to run Prowler?Yes. Prowler needs read-only credentials (SecurityAudit and ViewOnlyAccess managed policies plus a few extra read permissions) in an account you own or are authorized to assess. Does Prowler support Azure and GCP?Yes. Current Prowler versions include providers for AWS, Azure, Google Cloud, Kubernetes, Microsoft 365 and more, each with its own checks and compliance mappings. --- # Nuclei Vulnerability Scanning: Templates, Workflows and Writing Your Own Checks URL: https://pentestwiki.org/web-security/nuclei-vulnerability-scanning-templates/ Published: 2026-10-01 | Updated: 2026-11-26 Category: Web Security | Tags: automation, cve, nuclei, pentesting, web Nuclei is a fast, template-driven vulnerability scanner from ProjectDiscovery. Its strength is a large library of community YAML templates plus the ability to write your own checks. This guide covers safe scanning, tuning, chaining Nuclei into a recon pipeline, and authoring custom templates — all for targets you are authorized to test. Nuclei, a template-based scanner. Source: projectdiscovery/nuclei. ## Installation ``` # Go go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest # or download a release binary, then fetch the templates nuclei -update-templates nuclei -version ``` ## A safe first scan Start non-intrusive. Exclude anything that fuzzes, floods or attempts logins. ``` nuclei -u https://staging.example.com \ -exclude-tags intrusive,dos,fuzz,brute \ -severity low,medium,high,critical \ -rate-limit 50 \ -o nuclei_report.txt ``` Some templates are intrusive by design. Exclude the dos, fuzz, intrusive and brute tags, set a rate limit, and agree a testing window with the system owner before running against anything live. ## Selecting what to run ``` # By tag (e.g. only CVEs and misconfigurations) nuclei -u https://staging.example.com -tags cve,misconfiguration # By template path nuclei -u https://staging.example.com -t http/technologies/ # By severity only nuclei -l targets.txt -severity high,critical ``` ## Chaining a recon pipeline Nuclei shines at the end of a discovery pipeline built from other ProjectDiscovery tools, against assets in your scope. ``` # Subdomains -> live hosts -> scan, staying inside an authorized scope subfinder -d example.com -silent \ | httpx -silent \ | nuclei -exclude-tags intrusive,dos -severity medium,high,critical ``` The Nuclei workflow: write a template, run it against targets. Source: projectdiscovery/nuclei. ## Writing a custom template Templates are YAML. Here is a safe check that flags a missing security header — useful for your own apps. ``` id: missing-hsts-header info: name: Missing Strict-Transport-Security header author: pentestwiki severity: low tags: misconfig,headers http: - method: GET path: - "{{BaseURL}}" matchers-condition: and matchers: - type: status status: - 200 - type: word part: header words: - "Strict-Transport-Security" negative: true ``` ``` # Validate and run your template nuclei -validate -t missing-hsts-header.yaml nuclei -u https://staging.example.com -t missing-hsts-header.yaml ``` ## Reducing false positives - Prefer templates with strong matchers — status and body and header conditions together. - Manually verify every high or critical result before it goes in a report. - Keep templates current with nuclei -update-templates. - Use -rate-limit and -c (concurrency) responsibly so you don't disrupt the target. ### Key takeaways - Start non-intrusive: exclude dos, fuzz, intrusive and brute, and rate-limit. - Filter by tag and severity so you run only what's relevant. - Chain subfinder → httpx → nuclei for scope-wide coverage. - Custom YAML templates let you codify your own checks; always verify high-severity hits by hand. ## Frequently asked questions Is Nuclei safe to run against production?Most templates send benign requests, but some are intrusive or fuzzing-based. Exclude tags such as dos, fuzz and intrusive, set rate limits and agree on a testing window with the system owner. How do I reduce false positives?Use templates with strong matchers (status plus body plus header conditions), verify every high or critical result manually and keep templates updated with nuclei -update-templates. --- # Android Dynamic Analysis with Frida: Hooking, SSL Pinning Bypass and Runtime Tampering URL: https://pentestwiki.org/mobile-security/frida-android-dynamic-instrumentation/ Published: 2026-09-17 | Updated: 2026-11-26 Category: Mobile Security | Tags: android, frida, mobsf, pentesting Frida is a dynamic instrumentation toolkit that lets you inspect and modify a running application. In authorized Android assessments it is the standard way to understand runtime behaviour, trace functions, and work around client-side protections such as certificate pinning and root detection. This guide sets up a test environment and shows reusable patterns, all within the OWASP Mobile Application Security Testing Guide (MASTG). Instrumentation and pinning bypass are legitimate techniques in authorized mobile assessments. Doing this against an app or service without permission may breach terms of service or law. Test only apps you build or are explicitly scoped to assess, on a device you control. frida-trace following calls in an Android app. Source: the Frida project. ## Setting up the environment You need frida-tools on your workstation and frida-server on a rooted test device or emulator. ``` # Workstation pip install frida-tools frida --version # Download the matching frida-server for the device architecture from the # Frida releases page, push it and run it (versions must match frida-tools) adb push frida-server /data/local/tmp/ adb shell "chmod 755 /data/local/tmp/frida-server" adb shell "su -c /data/local/tmp/frida-server &" ``` On a non-rooted device you can instead embed the Frida Gadget into a repackaged build of an app you are authorized to test. The version of frida-tools and frida-server/Gadget must match exactly, or hooks silently fail. ## Finding and attaching to the app ``` # List running processes / installed apps frida-ps -Uai # Spawn the app under instrumentation (recommended, so you hook early) frida -U -f com.example.app -l hooks.js --no-pause # Attach to an already running process frida -U -n "Example" -l hooks.js ``` Spawning with -f is important: many checks run during startup, so attaching afterwards misses them. ## Tracing functions ``` # Trace Java methods matching a pattern frida-trace -U -f com.example.app -j '*!*login*' # Trace native (libc) functions frida-trace -U -n Example -i "open" -i "strcmp" ``` ## Hooking Java methods A Frida script runs inside the app and can read arguments, change return values and call original implementations. ``` Java.perform(function () { // Observe arguments and return value of a method var Login = Java.use('com.example.app.AuthManager'); Login.verify.implementation = function (user, pass) { console.log('[hook] verify(' + user + ', ' + pass.length + ' chars)'); var result = this.verify(user, pass); // call the real method console.log('[hook] verify returned ' + result); return result; }; }); ``` ## Bypassing certificate pinning (for traffic analysis) To inspect an app's API traffic through your proxy during an authorized test, you often need to relax pinning. Rather than paste a brittle script, use a maintained one such as the community "universal" Android pinning-bypass scripts from the Frida CodeShare repository, and load it alongside your proxy CA: ``` # Load a maintained CodeShare pinning-bypass script by handle frida -U -f com.example.app --codeshare pcipolloni/universal-android-ssl-pinning-bypass-with-frida --no-pause ``` With pinning relaxed and your proxy's CA trusted by the test device, the app's HTTPS requests appear in your intercepting proxy for review. Document exactly what you changed; the finding is "the app can be made to trust an attacker-controlled CA via X", and the fix is stronger, defence-in-depth pinning plus server-side controls. ## Root and tamper detection Apps frequently check for root or for being run under a debugger. During an assessment you hook the detection method to understand and document it: ``` Java.perform(function () { var Checks = Java.use('com.example.app.security.RootCheck'); Checks.isDeviceRooted.implementation = function () { console.log('[hook] root check called — reporting result for the write-up'); return this.isDeviceRooted(); // observe first; override only if scoped to }; }); ``` Report what the protection does and how robust it is. Client-side checks raise the bar but can always be bypassed on a device the user fully controls — so the real recommendation is to never rely on them as the only control and to enforce security server-side. ## Troubleshooting - Nothing hooks: version mismatch between frida-tools and frida-server, or you attached too late — use -f to spawn. - Class not found: names are obfuscated; enumerate with Java.enumerateLoadedClasses() or map names from the decompiled APK. - Logic is in native code: switch to Interceptor.attach on exported symbols or offsets. ### Key takeaways - Spawn with -f so you hook startup checks before they run. - frida-tools and frida-server versions must match exactly. - Pinning bypass is for inspecting traffic in authorized tests — use maintained CodeShare scripts and document the change. - Client-side root/tamper checks raise the bar but can't be the only control; enforce security server-side. ## Frequently asked questions Does Frida require a rooted device?Running frida-server requires root. On non-rooted devices you can embed the Frida Gadget library into a repackaged APK of an app you are authorized to test. Why does my Frida script not hook anything?Common causes are a version mismatch between frida-tools and frida-server, attaching after the code already ran (use spawn with -f), obfuscated class names or methods implemented in native code. Is bypassing SSL pinning legal?It is a standard technique in authorized mobile assessments (OWASP MASTG). Doing it against apps or services without permission may breach terms of service or law. Test only within an agreed scope. --- # ERC-4626 Vault Inflation Attacks: How First-Depositor Exploits Work and How to Stop Them URL: https://pentestwiki.org/blockchain/erc-4626-vault-inflation-attack/ Published: 2026-08-27 | Updated: 2026-11-26 Category: Blockchain | Tags: defi, erc4626, ethereum, solidity, web3 ERC-4626 is the standard for tokenized yield-bearing vaults. Its share accounting introduced a now-famous class of bug: the "inflation" or "first-depositor" attack, where an attacker manipulates the share price so the next depositor's shares round down to almost nothing. This article explains the mechanism, the math, how to prove it with Foundry, and the mitigations auditors expect. Share price under an inflation attack. Source: OpenZeppelin ERC-4626 documentation. ## How vault shares work A vault mints "shares" representing a claim on the underlying assets. The conversion is: ``` shares minted = assets_deposited * totalSupply / totalAssets ``` When the vault is empty (totalSupply == 0) the first depositor typically gets shares 1:1. The problem lives in the interaction between an empty vault and Solidity's integer rounding. ## The attack, step by step - The attacker is the first depositor and deposits the smallest unit — 1 wei of the asset — receiving 1 share. Now totalSupply == 1. - The attacker donates a large amount of the asset directly to the vault (a plain transfer, not a deposit). Now totalAssets is large but totalSupply is still 1. One share is now "worth" the whole balance. - A victim deposits, say, 10 tokens. Their shares are 10 * 1 / totalAssets, which rounds down to 0 when the donation made totalAssets bigger than the victim's deposit. - The victim receives 0 (or near-0) shares but their assets are now in the vault. The attacker redeems their single share and walks away with most of the victim's deposit. The root cause is a rounding-down conversion combined with an attacker's ability to inflate totalAssets without minting shares. Any custom vault that converts assets to shares with integer division is a candidate. ## Proving it with Foundry A proof of concept outline (run against a copy of the target in a test environment you control): ``` function test_inflation() public { // Attacker seeds the empty vault with 1 wei vm.prank(attacker); vault.deposit(1, attacker); // Attacker donates directly to inflate the share price vm.prank(attacker); asset.transfer(address(vault), 10_000e18); // Victim deposits — observe shares rounding to zero vm.prank(victim); uint256 shares = vault.deposit(10e18, victim); assertEq(shares, 0); // victim got nothing for 10 tokens } ``` ## Mitigations ### 1. Virtual shares and assets (decimals offset) OpenZeppelin's ERC4626 implementation (since v4.9) adds a virtual offset so the vault behaves as if it already holds a tiny amount of shares and assets. This makes the rounding error negligible and the donation attack unprofitable. You configure it by overriding _decimalsOffset(). ``` function _decimalsOffset() internal view virtual override returns (uint8) { return 6; // larger offset => stronger protection } ``` ### 2. Seed the vault on deployment Deposit a non-trivial initial amount (and optionally burn those shares to a dead address) so the vault is never in the empty state an attacker needs. ### 3. Internal balance accounting Track deposited assets in a storage variable rather than reading asset.balanceOf(this), so a direct donation does not change totalAssets. ### 4. Slippage protection for users Expose mint/deposit variants with a minimum-shares-out parameter, and have front ends enforce it so a user never silently receives zero shares. ## Auditor's checklist - What happens when totalSupply == 0? Is the first deposit special-cased safely? - Rounding direction of every conversion — does it ever favour the protocol over the user in a way an attacker can exploit? - Does a direct token transfer to the vault change totalAssets? - Is there a decimals offset or virtual-shares protection? - Is there slippage protection on deposit and mint? ### Key takeaways - The inflation attack abuses rounding-down in an empty vault plus a direct donation to inflate share price. - OpenZeppelin's virtual shares / decimals offset makes it unprofitable; custom vaults must add equivalent protection. - Seeding the vault and using internal accounting both remove the preconditions. - Always give users slippage protection so a deposit can never silently return zero shares. ## Frequently asked questions What is an ERC-4626 inflation attack?An attacker deposits a tiny amount into an empty vault, then donates assets directly to it to inflate the share price so that the next depositor’s shares round down to zero or near zero, letting the attacker redeem most of the victim’s deposit. Does OpenZeppelin’s ERC4626 prevent it?Since version 4.9 the OpenZeppelin implementation uses virtual shares and assets with a configurable decimals offset, which makes the attack unprofitable. Custom vaults must implement an equivalent protection. What should auditors check in a vault?Rounding direction in every conversion, behaviour when totalSupply is zero, donation handling, decimals offset, slippage protection for users and whether the deployer seeds the vault with an initial deposit. --- # Detecting Reentrancy and Other Smart Contract Bugs with Mythril Symbolic Execution URL: https://pentestwiki.org/blockchain/mythril-symbolic-execution-reentrancy/ Published: 2026-08-06 | Updated: 2026-11-26 Category: Blockchain | Tags: ethereum, mythril, smart contracts, solidity, web3 Mythril is a security analysis tool for EVM bytecode that uses symbolic execution to explore many execution paths at once. It is particularly good at low-level bug classes such as reentrancy, unchecked external calls and integer issues. This guide explains reentrancy from The DAO to read-only reentrancy, then shows how to run Mythril and interpret its findings. Mythril analyses EVM bytecode with symbolic execution. Source: Consensys/mythril. ## What reentrancy actually is Reentrancy happens when a contract makes an external call before it updates its own state. The external callee can call back into the original function while the old state still applies, repeating an action — classically, withdrawing the same balance several times. ``` // Vulnerable pattern: external call before state update function withdraw() public { uint256 amount = balances[msg.sender]; (bool ok, ) = msg.sender.call{value: amount}(""); // external call first require(ok); balances[msg.sender] = 0; // state updated too late } ``` Because balances[msg.sender] is only zeroed after the call returns, a malicious contract's receive() can call withdraw() again while its balance still reads the original amount. ### The checks-effects-interactions fix ``` function withdraw() public { uint256 amount = balances[msg.sender]; balances[msg.sender] = 0; // effect first (bool ok, ) = msg.sender.call{value: amount}(""); // interaction last require(ok); } ``` Update state before the external call, and optionally add a reentrancy guard. Note that a guard on one function does not stop cross-function or read-only reentrancy, where a view function used by another protocol returns stale values mid-transaction. ## Installing Mythril ``` # pip pip install mythril # Docker docker pull mythril/myth myth version ``` ## Running an analysis ``` # Analyse a Solidity source file (choose the compiler version) myth analyze contracts/Vault.sol --solv 0.8.21 # Analyse already-deployed bytecode myth analyze -a 0xYourContractAddress --rpc infura-mainnet # Increase exploration depth for deeper paths myth analyze contracts/Vault.sol --solv 0.8.21 --max-depth 32 -t 3 ``` The -t flag sets the number of transactions Mythril chains together; many stateful bugs only appear after two or three transactions, so raising it finds more at the cost of time. ## Reading the output Mythril reports findings with a SWC identifier (Smart Contract Weakness Classification), the function and a sample transaction trace. Common ones: SWCIssueMeaning SWC-107ReentrancyExternal call before state change. SWC-104Unchecked call return valueLow-level call result ignored. SWC-101Integer over/underflowMostly historical since Solidity 0.8 checks by default. SWC-105Unprotected ether withdrawalMissing access control on a withdrawal. Symbolic execution explores many paths but can produce false positives and cannot reason about business logic or economic attacks. Treat Mythril as one layer: combine it with Slither static analysis, Echidna fuzzing and manual review. ## Using Mythril in CI ``` # Fail the build if an issue at or above a severity is found myth analyze contracts/Vault.sol --solv 0.8.21 -o json > myth.json # then parse myth.json in your pipeline and gate on severity ``` ### Key takeaways - Reentrancy is caused by an external call before a state update — fix with checks-effects-interactions. - A reentrancy guard does not stop cross-function or read-only reentrancy. - Raise -t (transaction count) to catch stateful bugs that need several calls. - Mythril is one layer of an audit, not a replacement for manual review. ## Frequently asked questions What is reentrancy in Solidity?Reentrancy happens when a contract makes an external call before updating its own state, allowing the callee to call back into the contract and act on stale state — for example withdrawing the same balance several times. Does Mythril replace a manual audit?No. Mythril explores execution paths automatically and is excellent for low-level bugs, but it cannot understand business logic, economic attacks or cross-protocol assumptions. Use it as one layer of a full audit. Is ReentrancyGuard enough to prevent reentrancy?It blocks re-entering functions protected by the same guard, but not cross-contract or read-only reentrancy. Combine checks-effects-interactions, guards and careful review of view functions used by other protocols. --- # Smart Contract Fuzzing with Echidna: Property-Based Testing for Solidity Auditors URL: https://pentestwiki.org/blockchain/smart-contract-fuzzing-with-echidna/ Published: 2026-07-16 | Updated: 2026-11-26 Category: Blockchain | Tags: echidna, fuzzing, smart contracts, solidity, web3 Echidna is a property-based fuzzer for Ethereum smart contracts, built by Trail of Bits. Instead of checking specific inputs the way unit tests do, it generates thousands of random transaction sequences trying to break the invariants you declare. This guide covers installation, writing properties and assertions, configuring campaigns and turning a failure into a high-quality audit finding. Echidna, a property-based fuzzer for EVM smart contracts. Source: crytic/echidna (Trail of Bits). ## Why fuzz smart contracts? Unit tests confirm that known inputs produce expected outputs. Fuzzing asks a different question: is there any sequence of calls that violates a rule that should always hold? For contracts holding value, "always" properties — total supply never exceeds the cap, the sum of balances equals total supply, a user can never withdraw more than they deposited — are exactly what an attacker tries to break. ## Installation ``` # Precompiled binary (Linux/macOS): download from the GitHub releases page, # or install with the Trail of Bits toolchain pip install crytic-compile slither-analyzer # Docker is the simplest reproducible option docker pull ghcr.io/crytic/echidna/echidna echidna --version ``` Echidna compiles your project with crytic-compile, so it understands Foundry, Hardhat and solc layouts automatically. ## Writing properties A property is a public or external function named with your chosen prefix (default echidna_) that returns a boolean. Echidna tries to make it return false. ``` // Token.property.sol import "./Token.sol"; contract TokenTest is Token { address echidna_caller = msg.sender; // Property: no account can ever hold more than the total supply. function echidna_balance_under_supply() public view returns (bool) { return balanceOf(echidna_caller) <= totalSupply(); } // Property: total supply never exceeds the hard cap. function echidna_supply_capped() public view returns (bool) { return totalSupply() <= CAP; } } ``` ``` echidna Token.property.sol --contract TokenTest ``` If Echidna finds a call sequence where a property returns false, it prints the shrunken sequence — the minimal set of calls that triggers the failure. ## Assertion mode Assertion mode checks assert() statements inside your functions, which is convenient for invariants that depend on function arguments. ``` function transfer(address to, uint256 amount) public override { uint256 before = balanceOf(msg.sender) + balanceOf(to); super.transfer(to, amount); // The combined balance of two parties must not change on transfer. assert(balanceOf(msg.sender) + balanceOf(to) == before); } ``` ``` echidna Token.sol --contract Token --test-mode assertion ``` ## Configuring a campaign A YAML config keeps runs reproducible. ``` # echidna.yaml testMode: assertion testLimit: 100000 # number of transactions to try seqLen: 50 # max calls per sequence shrinkLimit: 5000 # effort spent minimising a failing case corpusDir: corpus # save/replay the corpus between runs coverage: true sender: ["0x10000", "0x20000", "0x30000"] ``` ``` echidna Token.sol --contract Token --config echidna.yaml ``` Saving a corpusDir lets later runs continue from the coverage already reached, which is what makes long overnight campaigns worthwhile. ## From a failure to an audit finding When Echidna breaks a property it gives you a concrete, reproducible sequence. A good finding writes that up clearly: - State the invariant that was violated and why it matters. - Include the shrunken sequence Echidna produced as the proof of concept. - Explain the root cause in the contract logic — rounding, missing check, reentrancy. - Recommend a fix and, ideally, add the property to the project's test suite so it never regresses. Echidna and Foundry fuzzing complement each other. Foundry's invariant tests live next to unit tests and run fast in CI; Echidna's coverage-guided campaigns with corpus management often reach deeper states. Many auditors express the same invariants in both. See our Foundry guide. ### Key takeaways - Fuzzing finds call sequences that break invariants you declare — not just known inputs. - Property mode checks boolean functions; assertion mode checks assert() inside your code. - Save a corpus and run long campaigns before a report or release. - Every failure ships with a shrunken, reproducible proof of concept — perfect for the report. ## Frequently asked questions What is Echidna?Echidna is an open-source, property-based fuzzer for Ethereum smart contracts developed by Trail of Bits. It generates sequences of transactions trying to falsify user-defined properties or assertions. Echidna or Foundry fuzzing — which should I use?Both. Foundry’s fuzz and invariant tests are fast and live next to unit tests; Echidna offers grammar-aware, coverage-guided campaigns, corpus management and shrinking that often reach deeper states. Many auditors run the same invariants in both. How long should a fuzzing campaign run?Start with minutes during development, then run long campaigns (hours to days) before an audit report or a release, saving the corpus so later runs continue from the coverage already reached. --- # Nmap for Penetration Testers: The Complete Network Reconnaissance and Scanning Guide URL: https://pentestwiki.org/infrastructure/nmap-network-reconnaissance-guide/ Published: 2026-06-25 | Updated: 2026-11-26 Category: Infrastructure | Tags: ceh, enumeration, nmap, oscp, pentesting Nmap (Network Mapper) is the first tool most penetration testers reach for. This guide covers host discovery, port scanning, service and OS detection, the Nmap Scripting Engine, timing and output — and a repeatable workflow you can use on every internal or external engagement you are authorized to run. Only scan systems you own or have explicit, written permission to test. Unauthorized scanning can breach computer-misuse laws and provider terms of service. Everything below assumes an agreed scope. Nmap, the Network Mapper. Source: the Nmap project. ## Installing Nmap ``` # Debian / Ubuntu sudo apt update && sudo apt install nmap # Fedora sudo dnf install nmap # macOS (Homebrew) brew install nmap nmap --version ``` ## Host discovery Before scanning ports, find which hosts are alive. On an internal /24 this is fast and polite to the network. ``` # Ping sweep (no port scan), greppable output nmap -sn 10.0.0.0/24 -oG hosts_up.txt # When ICMP is filtered, probe common ports for liveness nmap -sn -PS22,80,443 -PA3389 10.0.0.0/24 ``` -sn disables the port scan so you only learn which hosts respond. In environments that block ICMP, TCP SYN/ACK discovery probes (-PS/-PA) are more reliable. ## Port scanning basics Nmap's default is a SYN scan (-sS) when run as root, which never completes the TCP handshake and is relatively quiet, and a full-connect scan (-sT) otherwise. ``` # Default top 1000 TCP ports nmap TARGET # All 65535 TCP ports at a steady rate nmap -p- --min-rate 2000 -oA allports TARGET # A specific set of ports nmap -p 22,80,443,8080 TARGET # UDP scan of the most common services (slow — keep it focused) sudo nmap -sU --top-ports 50 TARGET ``` FlagScan typeNotes -sSTCP SYN (half-open)Needs root; fast; does not complete the handshake. -sTTCP connect()No root needed; uses the OS stack; more likely logged. -sUUDPSlow; essential for DNS, SNMP, VPN discovery. -snNo port scanHost discovery only. ## Service and OS detection ``` # Version detection + default scripts on the open ports you found nmap -p 22,80,443 -sV -sC TARGET # Add OS detection (needs root) sudo nmap -p- -sV -O TARGET # Aggressive: -sV, -O, default scripts and traceroute in one sudo nmap -A TARGET ``` -sV fingerprints the service and version behind each open port; -O guesses the operating system from TCP/IP stack behaviour. Record versions carefully — they feed your vulnerable-components analysis. ## The Nmap Scripting Engine (NSE) NSE scripts extend Nmap with discovery, version and vulnerability checks. Categories let you stay within a safe boundary. ``` # Safe, non-intrusive scripts nmap -sV --script "default,safe" TARGET # Enumerate a specific service (example: HTTP) nmap -p 80,443 --script "http-title,http-headers,http-methods" TARGET # Update the script database sudo nmap --script-updatedb ``` Scripts in the intrusive, exploit, dos and brute categories can disrupt services or attempt logins. Only use them when your rules of engagement explicitly allow it, and never on production without agreement. ## Timing and performance ``` # Timing templates: -T0 (paranoid) .. -T5 (insane). -T4 is a common default. nmap -T4 -p- TARGET # Explicit rate control for fragile networks nmap --min-rate 500 --max-rate 1500 --max-retries 2 TARGET ``` Higher timing is faster but noisier and can overwhelm fragile devices. On OT or legacy networks, drop to -T2 and cap the rate. ## Output formats ``` # Save in all formats at once (normal, XML, greppable) nmap -sV -sC -oA engagement_scan TARGET # Convert XML to a readable HTML report xsltproc engagement_scan.xml -o engagement_scan.html ``` Always keep machine-readable output (-oX/-oG). It feeds other tools and gives you an evidence trail for the report. ## A repeatable workflow - Discover live hosts with -sn across the scope. - Sweep all TCP ports fast (-p- --min-rate) and save with -oA. - Enumerate only the open ports with -sV -sC (and -O where allowed). - Target interesting services with specific NSE scripts. - UDP scan the top ports separately — don't forget DNS, SNMP and VPN. - Record everything and move findings into your notes with timestamps. ### Key takeaways - Scan in phases: discovery, fast port sweep, then targeted service enumeration. - -sS is quiet and needs root; -sT works without privileges but is more likely logged. - Use NSE categories to stay within scope — avoid intrusive/brute unless allowed. - Always save machine-readable output with -oA for evidence and tool chaining. ## Frequently asked questions Is it legal to scan with Nmap?Scanning systems you own or have written permission to test is legal in most jurisdictions. Scanning third-party networks without authorization can violate computer misuse laws and provider terms of service. Always work under a signed scope. What is the difference between -sS and -sT?-sS performs a half-open SYN scan that needs raw socket privileges and never completes the TCP handshake. -sT uses the operating system connect() call, completes the handshake, works without root and is more likely to be logged. How do I scan all 65535 ports quickly?Use -p- with a reasonable --min-rate (for example 1000–5000 on a stable network) and -T4, then run a second, slower scan with -sV -sC only against the open ports you found. --- # OWASP Top 10 Explained for Penetration Testers: How to Find and Exploit Every Category URL: https://pentestwiki.org/web-security/owasp-top-10-explained-for-penetration-testers/ Published: 2026-06-04 | Updated: 2026-11-26 Category: Web Security | Tags: owasp, pentesting, sql, ssrf, web, xss The OWASP Top 10 is the most widely referenced awareness document in application security. For a penetration tester it is a shared vocabulary with developers and a checklist for prioritising a web assessment. This guide walks through all ten 2021 categories: what each risk means, how we test for it during an authorized engagement, and how developers should fix it. The Top 10 is an awareness document, not a complete methodology. Pair it with the OWASP Web Security Testing Guide (WSTG) for procedure and the ASVS for verification requirements. How the 2017 categories were restructured into the 2021 Top 10. Source: OWASP Foundation. ## A01:2021 — Broken Access Control Access control enforces what an authenticated user is allowed to do. It moved to the number one position because it was the most common serious finding in the contributed data set. Typical flaws are Insecure Direct Object References (IDOR), missing function-level authorization, and trusting client-side role checks. How we test it: we log in as two users of different privilege levels, capture a request that returns one user's data, and replay it as the other user, changing only the identifier. If user A can read or modify user B's object, access control is broken. We also request admin-only endpoints as a low-privileged user and check whether the server — not just the UI — refuses them. How to fix it: enforce authorization on the server for every request, deny by default, and base checks on the authenticated session rather than any value the client can change. Use opaque or ownership-checked identifiers and log access-control failures. ## A02:2021 — Cryptographic Failures Previously "Sensitive Data Exposure". The root cause is usually data that should be protected in transit or at rest but isn't, or is protected with weak algorithms. How we test it: we confirm TLS is enforced site-wide (including HSTS), look for sensitive data sent over plain HTTP or placed in URLs, check for weak hashing of passwords, and review whether secrets end up in logs, caches or backups. How to fix it: enforce HTTPS with HSTS, hash passwords with a memory-hard function such as Argon2id or bcrypt, use authenticated encryption for stored secrets, and classify data so you know what actually needs protection. ## A03:2021 — Injection Injection (SQL, NoSQL, OS command, LDAP, and cross-site scripting, now folded in here) happens when untrusted input is interpreted as code or query structure. How we test it: we send inputs that would change the meaning of a query or command only if the application concatenates them unsafely, and we watch for errors, timing differences, or reflected content. For XSS we check whether user input is rendered back into HTML, attributes or JavaScript without context-aware encoding. How to fix it: use parameterised queries / prepared statements, never build queries by string concatenation, validate input against an allow-list, and apply output encoding appropriate to the context. A strong Content-Security-Policy is defence in depth against XSS. ## A04:2021 — Insecure Design A new category that captures flaws in the design itself — missing or ineffective controls that no amount of clean implementation can fix. Examples: a password-reset flow with no rate limit, or a business process that trusts the client to enforce a limit. How we test it: we threat-model the critical flows and ask what an abuser would do. Testing here is less about payloads and more about logic: can a workflow be skipped, replayed, or raced? How to fix it: threat model early, write abuse cases alongside use cases, and build security requirements (rate limits, segregation, limits on value) into the design before coding. ## A05:2021 — Security Misconfiguration Default accounts, verbose errors, unnecessary features enabled, missing security headers, or an over-permissive cloud bucket. How we test it: we review HTTP responses for stack traces and version banners, check for default credentials on admin panels, and confirm the presence of security headers. Automated scanners like Nuclei are effective here. How to fix it: harden by default, remove unused components, automate configuration so every environment is consistent, and review cloud resource permissions. ## A06:2021 — Vulnerable and Outdated Components Running a library or framework with known vulnerabilities. How we test it: we fingerprint component versions and compare against public advisories. In a white-box review we run software-composition analysis over the dependency manifest. How to fix it: maintain an inventory (an SBOM), subscribe to advisories, patch on a schedule, and remove dependencies you don't use. See our Trivy guide for automating this. ## A07:2021 — Identification and Authentication Failures Weak passwords permitted, credential stuffing not mitigated, session identifiers exposed or not rotated, weak multi-factor implementation. How we test it: we check password policy, whether accounts lock or throttle after repeated failures, whether session tokens are invalidated on logout and rotated on login, and whether MFA can be bypassed. How to fix it: support long passphrases and screen them against breach lists, add rate limiting and MFA, and manage sessions server-side with secure cookie attributes. ## A08:2021 — Software and Data Integrity Failures Trusting code, updates or data without verifying integrity — for example an auto-update mechanism without signature verification, or insecure deserialization. How we test it: we review update and CI/CD pipelines for signing and verification, and look for deserialization of attacker-controllable data. How to fix it: verify digital signatures on updates and dependencies, pin and review third-party build steps, and avoid deserializing untrusted data. ## A09:2021 — Security Logging and Monitoring Failures Without logging and alerting, breaches go unnoticed. This category is about the ability to detect and respond. How we test it: during an engagement we note whether our own testing generated any detectable signal, and we review whether authentication, access-control and server-side failures are logged. How to fix it: log security-relevant events with enough context, centralise and protect logs, and alert on suspicious patterns. Test your detection with tabletop exercises. ## A10:2021 — Server-Side Request Forgery (SSRF) SSRF occurs when an application fetches a remote resource from a URL the user controls, letting an attacker make the server request internal systems. How we test it: wherever the app fetches a URL (webhooks, image importers, PDF generators) we point it at a controlled, out-of-band endpoint we own and watch for a callback that proves the server made the request. How to fix it: validate and allow-list destinations, resolve and check addresses to block internal ranges, disable unused URL schemes, and isolate the fetching service. ### Key takeaways - Broken Access Control is the most common serious finding — always test with multiple user roles. - Scanners find injection, misconfiguration and outdated components well; access control, insecure design and business logic need manual testing. - Map every finding to a Top 10 category so developers immediately understand the risk and the fix. - The Top 10 prioritises and communicates; the WSTG and ASVS give you procedure and verification depth. ## Frequently asked questions What is the OWASP Top 10?The OWASP Top 10 is a consensus document published by the Open Worldwide Application Security Project that ranks the most critical security risks to web applications, based on data contributed by security vendors and a community survey. Is the OWASP Top 10 a testing methodology?No. It is an awareness document. For a full methodology use the OWASP Web Security Testing Guide (WSTG) and, for verification requirements, the OWASP ASVS. The Top 10 is a good way to prioritise and communicate risk. Which OWASP Top 10 category is most common?Broken Access Control has been ranked first since the 2021 edition; it was found in the large majority of tested applications. In practice IDOR and missing function-level authorization are the most frequent findings in web pentests. Can automated scanners find all OWASP Top 10 issues?No. Scanners such as OWASP ZAP or Nuclei are good at injection, misconfiguration and known vulnerable components, but access control, insecure design and business logic flaws require manual testing with multiple user roles. --- # Crypto Timeline: What happened from 1998 to nowadays URL: https://pentestwiki.org/blockchain/crypto-timeline/ Published: 2022-09-06 | Updated: 2022-09-06 Category: Blockchain | Tags: bitcoin, blockchain, ethereum ## 1998 - Wei Dai, B-money paper - Nick Szabo, Bit Gold ## 2004 - Hal Finney, RPOW ## 2009 - Bitcoin ## 2010 - Mt. Gox exchange ## 2011 - Kraken exchange - SilkRoad ## 2012 - Coinbase exchange ## 2013 - First ICO - Foodler accepts Bitcoin (First food ordering service with Bitcoin). Average of 9 BTC per account (1 BTC = $88) ## 2014 - First stablecoin ## 2015 - Ethereum ## 2017 - Opensea - Binance exchange - Cryptokitties NFT collection - Cryptopunks NFT collection ## 2018 - Uniswap - ERC-721 ## 2019 - MATIC ## 2020 ## 2021 - Bored Ape Yacht Club NFT collection ## 2022 --- # How to use ConsenSys Surya smart contracts tool URL: https://pentestwiki.org/blockchain/how-to-use-consensys-surya-smart-contracts-tool/ Published: 2022-09-06 | Updated: 2022-09-06 Category: Blockchain | Tags: smart contracts, solidity, surya, web3 Surya is a tool developed by ConsenSys that help us to explore smart contracts. First, to install locally use npm: ``` $ npm install surya npm WARN deprecated sha1-file@1.0.4: Version 1.x or earlier is no longer supported. added 64 packages, and audited 65 packages in 9s 3 moderate severity vulnerabilities Some issues need review, and may require choosing a different dependency. Run `npm audit` for details. ``` Command line options: ``` $ node_modules/surya/bin/surya help surya [args] Commands: surya describe show file contracts structure. surya graph generate graph of contract function calls. surya inheritance generate graph of contract inheritance tree. surya dependencies output a linearized list of smart contract dependencies (linerized inherited parents). surya flatten output to a single flattened solidity file surya parse output AST generated by the parser for the specified file in a textual tree format. surya ftrace output the selected function call trace in a textual tree format. External calls are marked in `orange` and internal calls are `uncolored`. surya mdreport output a markdown file Options: -h, --help Show help [boolean] -v, --version Show version number [boolean] ``` Usage against a vulnerable contract (public burn method): ``` $ node_modules/surya/bin/surya describe ShadowFiToken.sol + [Lib] SafeMath - [Int] add - [Int] sub - [Int] sub - [Int] mul - [Int] div - [Int] div + [Int] IBEP20 - [Ext] totalSupply - [Ext] decimals - [Ext] symbol - [Ext] name - [Ext] getOwner - [Ext] balanceOf - [Ext] transfer # - [Ext] allowance - [Ext] approve # - [Ext] transferFrom # + [Int] IDEXFactory - [Ext] createPair # + [Int] IDEXRouter - [Ext] factory - [Ext] WETH - [Ext] addLiquidity # - [Ext] addLiquidityETH ($) - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens # - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($) - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens # + ShadowAuth - [Pub] # - [Pub] authorizeFor # - modifiers: authorizedFor - [Pub] authorizeForMultiplePermissions # - modifiers: authorizedFor - [Pub] unauthorizeFor # - modifiers: authorizedFor - [Pub] unauthorizeForMultiplePermissions # - modifiers: authorizedFor - [Pub] isOwner - [Pub] isAuthorizedFor - [Pub] isAuthorizedFor - [Pub] transferOwnership # - modifiers: onlyOwner - [Pub] getPermissionNameToIndex - [Pub] getPermissionUnlockTime - [Pub] isLocked - [Pub] lockPermission # - modifiers: authorizedFor - [Pub] unlockPermission # + [Int] IDividendDistributor - [Ext] setDistributionCriteria # - [Ext] setShare # - [Ext] deposit ($) - [Ext] process # - [Ext] claimDividend # + DividendDistributor (IDividendDistributor) - [Pub] # - [Ext] setDistributionCriteria # - modifiers: onlyToken - [Ext] setShare # - modifiers: onlyToken - [Ext] deposit ($) - modifiers: onlyToken - [Ext] process # - modifiers: onlyToken - [Int] shouldDistribute - [Int] distributeDividend # - [Ext] claimDividend # - [Pub] getUnpaidEarnings - [Int] getCumulativeDividends - [Int] addShareholder # - [Int] removeShareholder # + ShadowFi (IBEP20, ShadowAuth) - [Pub] # - modifiers: ShadowAuth - [Ext] ($) - [Ext] totalSupply - [Ext] decimals - [Ext] symbol - [Ext] name - [Ext] getOwner - [Pub] balanceOf - [Ext] allowance - [Pub] approve # - [Ext] approveMax # - [Ext] transfer # - [Ext] transferFrom # - [Int] _transferFrom # - [Int] _basicTransfer # - [Int] checkTxLimit - [Int] shouldTakeFee - [Pub] getTotalFee - [Pub] getMultipliedFee - [Int] takeFee # - [Int] isSell - [Int] shouldSwapBack - [Int] swapBack # - modifiers: swapping - [Ext] triggerBuyback # - modifiers: authorizedFor - [Ext] clearBuybackMultiplier # - modifiers: authorizedFor - [Int] buyTokens # - modifiers: swapping - [Ext] setBuybackMultiplierSettings # - modifiers: authorizedFor - [Int] launched - [Int] launch # - [Ext] setTxLimit # - modifiers: authorizedFor - [Ext] setIsDividendExempt # - modifiers: authorizedFor - [Ext] setIsFeeExempt # - modifiers: authorizedFor - [Ext] setIsTxLimitExempt # - modifiers: authorizedFor - [Ext] setFees # - modifiers: authorizedFor - [Ext] setFeeReceivers # - modifiers: authorizedFor - [Ext] setSwapBackSettings # - modifiers: authorizedFor - [Ext] setTargetLiquidity # - modifiers: authorizedFor - [Ext] setDistributionCriteria # - modifiers: authorizedFor - [Ext] setDistributorSettings # - modifiers: authorizedFor - [Pub] getCirculatingSupply - [Pub] getLiquidityBacking - [Pub] isOverLiquified - [Ext] claimDividend # - [Ext] addPair # - modifiers: authorizedFor - [Ext] removeLastPair # - modifiers: authorizedFor - [Ext] setFeesOnNormalTransfers # - modifiers: authorizedFor - [Ext] setLaunchedAt # - modifiers: authorizedFor - [Ext] setAllowedAddress # - modifiers: onlyOwner - [Pub] burn # - [Ext] airdrop # - modifiers: onlyOwner - [Ext] isAirdropped - [Ext] setBlackListed # - modifiers: onlyOwner ($) = payable function # = non-constant function ``` For control flow graph, first install graphviz package: ``` # apt-get install graphviz ``` Then, ``` $ surya graph ShadowFiToken.sol | dot -Tpng > ShadowFiToken.png ``` --- # How to install and use Paradigm Foundry to test and deploy smart contracts URL: https://pentestwiki.org/blockchain/how-to-install-and-use-paradigm-foundry/ Published: 2022-09-05 | Updated: 2022-09-05 Category: Blockchain | Tags: ethereum, foundry, solidity, web3 As they say, Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust. Apart of the speed another difference with Truffle or Hardhat is that the scripts and tests in Foundry are written in Solidity, not Javascript. Let’s have a quick look how to install it in our Linux system and get to understand how to run all the tooling: ``` $ curl -L https://foundry.paradigm.xyz | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 1765 100 1765 0 0 4412 0 --:--:-- --:--:-- --:--:-- 4412 Installing foundryup... ######################################################################## 100.0% Detected your preferred shell is bash and added foundryup to PATH. Run 'source /home/user/.bashrc' or start a new terminal session to use foundryup. Then, simply run 'foundryup' to install Foundry. ``` ``` $ . .bashrc ``` ``` $ foundryup foundryup: installing foundry (version nightly, tag nightly-1c415857dd7b617190834dbcb361506f6143fed4) foundryup: downloading latest forge, cast and anvil ################################################################################################################################################# 100.0% foundryup: downloading manpages ################################################################################################################################################# 100.0% foundryup: installed - forge 0.2.0 (1c41585 2022-09-04T00:08:27.451724173Z) foundryup: installed - cast 0.2.0 (1c41585 2022-09-04T00:08:27.451724173Z) foundryup: installed - anvil 0.1.0 (1c41585 2022-09-04T00:08:27.527236025Z) foundryup: done ``` Let’s check the options of forge, cast, and anvil before continue: Forge is the Ethereum development and testing framework (Like hardhat or truffle): ``` $ forge forge 0.2.0 (1c41585 2022-09-04T00:08:27.451724173Z) Build, test, fuzz, debug and deploy Solidity contracts. USAGE: forge OPTIONS: -h, --help Print help information -V, --version Print version information SUBCOMMANDS: bind Generate Rust bindings for smart contracts. build Build the project's smart contracts. [aliases: b] cache Manage the Foundry cache. clean Remove the build artifacts and cache directories. [aliases: cl] completions Generate shell completions script. [aliases: com] config Display the current config. [aliases: co] coverage Generate coverage reports. create Deploy a smart contract. [aliases: c] debug Debugs a single smart contract as a script. [aliases: d] flatten Flatten a source file and all of its imports into one file. [aliases: f] fmt Formats Solidity source files. geiger Detects usage of unsafe cheat codes in a foundry project and its dependencies. generate-fig-spec Generate Fig autocompletion spec. [aliases: fig] help Print this message or the help of the given subcommand(s) init Create a new Forge project. inspect Get specialized information about a smart contract. [aliases: in] install Install one or multiple dependencies. [aliases: i] remappings Get the automatically inferred remappings for the project. [aliases: re] remove Remove one or multiple dependencies. [aliases: rm] script Run a smart contract as a script, building transactions that can be sent onchain. snapshot Create a snapshot of each test's gas usage. [aliases: s] test Run the project's tests. [aliases: t] tree Display a tree visualization of the project's dependency graph. [aliases: tr] update Update one or multiple dependencies. [aliases: u] upload-selectors Uploads abi of given contract to https://sig.eth.samczsun.com function selector database. [aliases: up] verify-check Check verification status on Etherscan. [aliases: vc] verify-contract Verify smart contracts on Etherscan. [aliases: v] Find more information in the book: http://book.getfoundry.sh/reference/forge/forge.html ``` Cast is the CLI to interact with smart contracts on a low-level basis: ``` $ cast cast 0.2.0 (1c41585 2022-09-04T00:08:27.451724173Z) Perform Ethereum RPC calls from the comfort of your command line. USAGE: cast OPTIONS: -h, --help Print help information -V, --version Print version information SUBCOMMANDS: --abi-decode Decode ABI-encoded input or output data [aliases: ad] --address-zero Get zero address [aliases: address-zero, az] --calldata-decode Decode ABI-encoded input data. [aliases: cdd] --concat-hex Concatenate hex strings. [aliases: concat-hex, ch] --format-bytes32-string Formats a string into bytes32 encoding. --from-bin Convert binary data into hex data. [aliases: from-bin, fb] --from-fix Convert a fixed point number into an integer. [aliases: from-fix, ff] --from-rlp Decodes RLP encoded data. Input must be hexadecimal. --from-utf8 Convert UTF8 text to hex. [aliases: from-utf8, --from-ascii, from-ascii, fu, fa] --from-wei Convert wei into an ETH amount. Consider using --to-unit. [aliases: from-wei, fw] --hash-zero Get zero hash [aliases: hash-zero, hz] --max-int Get the maximum i256 value. [aliases: max-int, maxi] --max-uint Get the maximum u256 value. [aliases: max-uint, maxu] --min-int Get the minimum i256 value. [aliases: min-int, mini] --parse-bytes32-string Parses a string from bytes32 encoding. --to-ascii Convert hex data to an ASCII string. [aliases: to-ascii, tas, 2as] --to-bytes32 Right-pads hex data to 32 bytes. [aliases: to-bytes32, tb, 2b] --to-checksum-address Convert an address to a checksummed format (EIP-55). [aliases: to-checksum-address, --to-checksum, to-checksum, ta, 2a] --to-dec Convert hex value into a decimal number. [aliases: to-dec, td, 2d] --to-fix Convert an integer into a fixed point number. [aliases: to-fix, tf, 2f] --to-hex Convert an integer to hex. [aliases: to-hex, th, 2h] --to-hexdata Normalize the input to lowercase, 0x-prefixed hex. See --help for more info. [aliases: to-hexdata, thd, 2hd] --to-int256 Convert a number to a hex-encoded int256. [aliases: to-int256, ti, 2i] --to-rlp RLP encodes hex data, or an array of hex data --to-uint256 Convert a number to a hex-encoded uint256. [aliases: to-uint256, tu, 2u] --to-unit Convert an ETH amount into another unit (ether, gwei or wei). [aliases: to-unit, tun, 2un] --to-wei Convert an ETH amount to wei. Consider using --to-unit. [aliases: to-wei, tw, 2w] 4byte Get the function signatures for the given selector from https://sig.eth.samczsun.com. [aliases: 4, 4b] 4byte-decode Decode ABI-encoded calldata using https://sig.eth.samczsun.com. [aliases: 4d, 4bd] 4byte-event Get the event signature for a given topic 0 from https://sig.eth.samczsun.com. [aliases: 4e, 4be] abi-encode ABI encode the given function argument, excluding the selector. [aliases: ae] access-list Create an access list for a transaction. [aliases: ac, acl] age Get the timestamp of a block. [aliases: a] balance Get the balance of an account in wei. [aliases: b] basefee Get the basefee of a block. [aliases: ba, fee] block Get information about a block. [aliases: bl] block-number Get the latest block number. [aliases: bn] call Perform a call on an account without publishing a transaction. [aliases: c] calldata ABI-encode a function with arguments. [aliases: cd] chain Get the symbolic name of the current chain. [aliases: ch] chain-id Get the Ethereum chain ID. [aliases: ci, cid] client Get the current client version. [aliases: cl] code Get the bytecode of a contract. [aliases: co] completions Generate shell completions script [aliases: com] compute-address Compute the contract address from a given nonce and deployer address. [aliases: ca] estimate Estimate the gas cost of a transaction. [aliases: e] etherscan-source Get the source code of a contract from Etherscan. [aliases: et, src] find-block Get the block number closest to the provided timestamp. [aliases: f] gas-price Get the current gas price. [aliases: g] generate-fig-spec Generate Fig autocompletion spec. [aliases: fig] help Print this message or the help of the given subcommand(s) index Compute the storage slot for an entry in a mapping. [aliases: in] interface Generate a Solidity interface from a given ABI. [aliases: i] keccak Hash arbitrary data using keccak-256. [aliases: k] lookup-address Perform an ENS reverse lookup. [aliases: l] namehash Calculate the ENS namehash of a name. [aliases: na, nh] nonce Get the nonce for an account. [aliases: n] pretty-calldata Pretty print calldata. [aliases: pc] proof Generate a storage proof for a given storage slot. [aliases: pr] publish Publish a raw transaction to the network. [aliases: p] receipt Get the transaction receipt for a transaction. [aliases: re] resolve-name Perform an ENS lookup. [aliases: rn] rpc Perform a raw JSON-RPC request [aliases: rp] run Runs a published transaction in a local environment and prints the trace. [aliases: r] send Sign and publish a transaction. [aliases: s] shl Perform a left shifting operation shr Perform a right shifting operation sig Get the selector for a function. [aliases: si] storage Get the raw value of a contract's storage slot. [aliases: st] tx Get information about a transaction. [aliases: t] upload-signature Upload the given signatures to https://sig.eth.samczsun.com. [aliases: ups] wallet Wallet management utilities. [aliases: w] Find more information in the book: http://book.getfoundry.sh/reference/cast/cast.html ``` And finally, cast is the local Ethereum node (Like Ganache or Hardhat node): ``` $ anvil _ _ (_) | | __ _ _ __ __ __ _ | | / _` | | '_ \ \ \ / / | | | | | (_| | | | | | \ V / | | | | \__,_| |_| |_| \_/ |_| |_| 0.1.0 (1c41585 2022-09-04T00:08:27.527236025Z) https://github.com/foundry-rs/foundry Available Accounts ================== (0) 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH) (1) 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 (10000 ETH) (2) 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc (10000 ETH) (3) 0x90f79bf6eb2c4f870365e785982e1f101e93b906 (10000 ETH) (4) 0x15d34aaf54267db7d7c367839aaf71a00a2c6a65 (10000 ETH) (5) 0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc (10000 ETH) (6) 0x976ea74026e726554db657fa54763abd0c3a0aa9 (10000 ETH) (7) 0x14dc79964da2c08b23698b3d3cc7ca32193d9955 (10000 ETH) (8) 0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f (10000 ETH) (9) 0xa0ee7a142d267c1f36714e4a8f75612f20a79720 (10000 ETH) Private Keys ================== (0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 (1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d (2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a (3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 (4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a (5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba (6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e (7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 (8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 (9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 Wallet ================== Mnemonic: test test test test test test test test test test test junk Derivation path: m/44'/60'/0'/0/ Base Fee ================== 1000000000 Gas Limit ================== 30000000 Genesis Timestamp ================== 1662332232 Listening on 127.0.0.1:8545 ``` Now let’s build the template project. First we have to initialize the forge template in an empty directory, so: ``` $ mkdir test $ forge init Initializing test... Installing forge-std in "/tmp/test/lib/forge-std" (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) Installed forge-std Initialized forge project. ``` That will create the following structure: ``` $ ls foundry.toml lib/ script/ src/ test/ ``` And this is the template contract: ``` // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; contract Counter { uint256 public number; function setNumber(uint256 newNumber) public { number = newNumber; } function increment() public { number++; } } ``` Now we can build the default project (src/Counter.sol): ``` $ forge build [⠊] Compiling... [⠰] installing solc version "0.8.16" [⠘] Successfully installed solc 0.8.16 [⠒] Compiling 10 files with 0.8.16 [⠒] Solc 0.8.16 finished in 3.90s Compiler run successful ``` ``` $ forge test [⠆] Compiling... No files changed, compilation skipped Running 2 tests for test/Counter.t.sol:CounterTest [PASS] testIncrement() (gas: 28312) [PASS] testSetNumber(uint256) (runs: 256, μ: 27531, ~: 28387) Test result: ok. 2 passed; 0 failed; finished in 35.94ms ``` To deploy the contract we must call the contract script, in this case under script/Counter.s.sol. One of the main differences between forge and truffle or hardhat is that in forge, the test scripts are written in Solidity instead of JavaScript: ``` $ cat script/Counter.s.sol // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import "forge-std/Script.sol"; contract CounterScript is Script { function setUp() public {} function run() public { vm.broadcast(); } } ``` The function run() will be called when the contract is being deployed. After the compile and test, we can run the scripts locally using one of the private keys given by anvil before and the local RPC node: ``` $ forge script script/Counter.s.sol:CounterScript --fork-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 [⠆] Compiling... No files changed, compilation skipped Script ran successfully. ``` And finally, deploy the contract on localnet: ``` $ forge create Counter --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 [⠆] Compiling... No files changed, compilation skipped Deployer: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 Deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3 Transaction hash: 0xe065e23fd862dfa2283ba4c87a77539dec4e3a972e5d90de265cb3b5d4de7ae6 ``` With the deployed address of the smart contract (0x5FbDB2315678afecb367f032d93F642f64180aa3), we can retrieve the smart contract bytecode directly from the local blockchain: ``` $ cast code 0x5FbDB2315678afecb367f032d93F642f64180aa3 0x6080604052348015600f57600080fd5b5060043610603c5760003560e01c80633fb5c1cb1460415780638381f58a146053578063d09de08a14606d575b600080fd5b6051604c3660046083565b600055565b005b605b60005481565b60405190815260200160405180910390f35b6051600080549080607c83609b565b9190505550565b600060208284031215609457600080fd5b5035919050565b60006001820160ba57634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220f4a9b22e7a2d64c24355b4e7a6f8c62115ca728f26fc2a1e98e364ee91f794fa64736f6c63430008100033 ``` To make a low-level call to a method of the smart contract, we can use cast call and cast send. To initialize the number: ``` $ cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3 "setNumber(uint256)" "34" --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 blockHash 0x9bc16ad14fc77a9a295145f69d2aa0ea43c494655620d2facce458f16a2b09cd blockNumber 3 contractAddress cumulativeGasUsed 26394 effectiveGasPrice 3671048612 gasUsed 26394 logs [] logsBloom 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 root status 1 transactionHash 0xd438f5b0dbd78ccbe3935fffc0b52c563cb5a654186b89a6fd1815177ce92e45 transactionIndex 0 type ``` To call increment(): ``` $ cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3 "increment()" --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 blockHash 0xe94baa8582bf0893a4cd69913f2d50a33eed5c41b7e2403bfa885f88437e89dd blockNumber 4 contractAddress cumulativeGasUsed 26304 effectiveGasPrice 3587314629 gasUsed 26304 logs [] logsBloom 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 root status 1 transactionHash 0x9783814115f16e979f377d3aea559afc5ce4a4dc4afac1161531f9bd1a255b5e transactionIndex 0 type ``` As mentioned in the Solidity documentation, the compiler creates getter() functions for all public state variables, so we can now call number() to validate that all methods worked successfully. To call cast call we do not need to specify a private key. Functions to just get data from the blockchain and do not modify them, do not consume gas… so they are free 🙂 ``` $ cast call 0x5FbDB2315678afecb367f032d93F642f64180aa3 "number()" 0x0000000000000000000000000000000000000000000000000000000000000023 ``` Seems it worked! Lets really check if 0x23 is 35 in decimal notation. ``` $ python3 Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 0x23 35 >>> ``` Mission accomplished! ## Bonus track: How to clone Mainnet with Anvil ``` anvil --fork-url https://mainnet.infura.io/v3/$INFURA_KEY ``` --- # Ethereum EVM low-level URL: https://pentestwiki.org/blockchain/ethereum-evm-low-level/ Published: 2022-08-31 | Updated: 2022-08-31 Category: Blockchain | Tags: blockchain, ethereum, evm, web3 If you wanna dig deeper at the Ethereum Virtual Machine level, those are some resources to start: EthTx Transaction Decoder https://ethtx.info/ Ethereum Signature Database https://www.4byte.directory/ Ethereum JSON-RPC API https://ethereum.org/es/developers/docs/apis/json-rpc/#eth_call Ethereum Virtual Machine Opcodes https://ethervm.io/ ## Solidity compiler EVM and OPCodes Let’s try with the following vulnerable (do not use!) smart contract: ``` // Filename: target.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract TxUserWallet { address owner; constructor() { owner = msg.sender; } function transferTo(address payable dest, uint amount) public { // THE BUG IS RIGHT HERE, you must use msg.sender instead of tx.origin require(tx.origin == owner); dest.transfer(amount); } } ``` Opcodes of the contract: ``` solc --opcodes target.sol ``` ``` ======= target.sol:TxUserWallet ======= Opcodes: PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1FE DUP1 PUSH2 0x60 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x2CCB1B30 EQ PUSH2 0x30 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x45 SWAP2 SWAP1 PUSH2 0x188 JUMP JUMPDEST PUSH2 0x4C JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ORIGIN PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC DUP3 SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0xEA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11F DUP3 PUSH2 0xF4 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x12F DUP2 PUSH2 0x114 JUMP JUMPDEST DUP2 EQ PUSH2 0x13A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x14C DUP2 PUSH2 0x126 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x165 DUP2 PUSH2 0x152 JUMP JUMPDEST DUP2 EQ PUSH2 0x170 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x182 DUP2 PUSH2 0x15C JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x19F JUMPI PUSH2 0x19E PUSH2 0xEF JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1AD DUP6 DUP3 DUP7 ADD PUSH2 0x13D JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x1BE DUP6 DUP3 DUP7 ADD PUSH2 0x173 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SELFDESTRUCT DUP12 0x5C DUP12 LOG3 PUSH31 0xF051A68ED77F5F39AD93423518F814BD59C16C9D1C94948A358C64736F6C63 NUMBER STOP ADDMOD LT STOP CALLER ``` EVM assembly of the contract: ``` solc --asm target.sol ``` ``` ======= target.sol:TxUserWallet ======= EVM assembly: /* "target.sol":116:449 contract TxUserWallet {... */ mstore(0x40, 0x80) /* "target.sol":167:218 constructor() {... */ callvalue dup1 iszero tag_1 jumpi 0x00 dup1 revert tag_1: pop /* "target.sol":200:210 msg.sender */ caller /* "target.sol":192:197 owner */ 0x00 dup1 /* "target.sol":192:210 owner = msg.sender */ 0x0100 exp dup2 sload dup2 0xffffffffffffffffffffffffffffffffffffffff mul not and swap1 dup4 0xffffffffffffffffffffffffffffffffffffffff and mul or swap1 sstore pop /* "target.sol":116:449 contract TxUserWallet {... */ dataSize(sub_0) dup1 dataOffset(sub_0) 0x00 codecopy 0x00 return stop sub_0: assembly { /* "target.sol":116:449 contract TxUserWallet {... */ mstore(0x40, 0x80) callvalue dup1 iszero tag_1 jumpi 0x00 dup1 revert tag_1: pop jumpi(tag_2, lt(calldatasize, 0x04)) shr(0xe0, calldataload(0x00)) dup1 0x2ccb1b30 eq tag_3 jumpi tag_2: 0x00 dup1 revert /* "target.sol":226:446 function transferTo(address payable dest, uint amount) public {... */ tag_3: tag_4 0x04 dup1 calldatasize sub dup2 add swap1 tag_5 swap2 swap1 tag_6 jump // in tag_5: tag_7 jump // in tag_4: stop tag_7: /* "target.sol":400:405 owner */ 0x00 dup1 sload swap1 0x0100 exp swap1 div 0xffffffffffffffffffffffffffffffffffffffff and /* "target.sol":387:405 tx.origin == owner */ 0xffffffffffffffffffffffffffffffffffffffff and /* "target.sol":387:396 tx.origin */ origin /* "target.sol":387:405 tx.origin == owner */ 0xffffffffffffffffffffffffffffffffffffffff and eq /* "target.sol":379:406 require(tx.origin == owner) */ tag_9 jumpi 0x00 dup1 revert tag_9: /* "target.sol":417:421 dest */ dup2 /* "target.sol":417:430 dest.transfer */ 0xffffffffffffffffffffffffffffffffffffffff and /* "target.sol":417:438 dest.transfer(amount) */ 0x08fc /* "target.sol":431:437 amount */ dup3 /* "target.sol":417:438 dest.transfer(amount) */ swap1 dup2 iszero mul swap1 mload(0x40) 0x00 mload(0x40) dup1 dup4 sub dup2 dup6 dup9 dup9 call swap4 pop pop pop pop iszero dup1 iszero tag_11 jumpi returndatasize 0x00 dup1 returndatacopy revert(0x00, returndatasize) tag_11: pop /* "target.sol":226:446 function transferTo(address payable dest, uint amount) public {... */ pop pop jump // out /* "#utility.yul":88:205 */ tag_13: /* "#utility.yul":197:198 */ 0x00 /* "#utility.yul":194:195 */ dup1 /* "#utility.yul":187:199 */ revert /* "#utility.yul":334:460 */ tag_15: /* "#utility.yul":371:378 */ 0x00 /* "#utility.yul":411:453 */ 0xffffffffffffffffffffffffffffffffffffffff /* "#utility.yul":404:409 */ dup3 /* "#utility.yul":400:454 */ and /* "#utility.yul":389:454 */ swap1 pop /* "#utility.yul":334:460 */ swap2 swap1 pop jump // out /* "#utility.yul":466:570 */ tag_16: /* "#utility.yul":511:518 */ 0x00 /* "#utility.yul":540:564 */ tag_28 /* "#utility.yul":558:563 */ dup3 /* "#utility.yul":540:564 */ tag_15 jump // in tag_28: /* "#utility.yul":529:564 */ swap1 pop /* "#utility.yul":466:570 */ swap2 swap1 pop jump // out /* "#utility.yul":576:714 */ tag_17: /* "#utility.yul":657:689 */ tag_30 /* "#utility.yul":683:688 */ dup2 /* "#utility.yul":657:689 */ tag_16 jump // in tag_30: /* "#utility.yul":650:655 */ dup2 /* "#utility.yul":647:690 */ eq /* "#utility.yul":637:708 */ tag_31 jumpi /* "#utility.yul":704:705 */ 0x00 /* "#utility.yul":701:702 */ dup1 /* "#utility.yul":694:706 */ revert /* "#utility.yul":637:708 */ tag_31: /* "#utility.yul":576:714 */ pop jump // out /* "#utility.yul":720:875 */ tag_18: /* "#utility.yul":774:779 */ 0x00 /* "#utility.yul":812:818 */ dup2 /* "#utility.yul":799:819 */ calldataload /* "#utility.yul":790:819 */ swap1 pop /* "#utility.yul":828:869 */ tag_33 /* "#utility.yul":863:868 */ dup2 /* "#utility.yul":828:869 */ tag_17 jump // in tag_33: /* "#utility.yul":720:875 */ swap3 swap2 pop pop jump // out /* "#utility.yul":881:958 */ tag_19: /* "#utility.yul":918:925 */ 0x00 /* "#utility.yul":947:952 */ dup2 /* "#utility.yul":936:952 */ swap1 pop /* "#utility.yul":881:958 */ swap2 swap1 pop jump // out /* "#utility.yul":964:1086 */ tag_20: /* "#utility.yul":1037:1061 */ tag_36 /* "#utility.yul":1055:1060 */ dup2 /* "#utility.yul":1037:1061 */ tag_19 jump // in tag_36: /* "#utility.yul":1030:1035 */ dup2 /* "#utility.yul":1027:1062 */ eq /* "#utility.yul":1017:1080 */ tag_37 jumpi /* "#utility.yul":1076:1077 */ 0x00 /* "#utility.yul":1073:1074 */ dup1 /* "#utility.yul":1066:1078 */ revert /* "#utility.yul":1017:1080 */ tag_37: /* "#utility.yul":964:1086 */ pop jump // out /* "#utility.yul":1092:1231 */ tag_21: /* "#utility.yul":1138:1143 */ 0x00 /* "#utility.yul":1176:1182 */ dup2 /* "#utility.yul":1163:1183 */ calldataload /* "#utility.yul":1154:1183 */ swap1 pop /* "#utility.yul":1192:1225 */ tag_39 /* "#utility.yul":1219:1224 */ dup2 /* "#utility.yul":1192:1225 */ tag_20 jump // in tag_39: /* "#utility.yul":1092:1231 */ swap3 swap2 pop pop jump // out /* "#utility.yul":1237:1727 */ tag_6: /* "#utility.yul":1313:1319 */ 0x00 /* "#utility.yul":1321:1327 */ dup1 /* "#utility.yul":1370:1372 */ 0x40 /* "#utility.yul":1358:1367 */ dup4 /* "#utility.yul":1349:1356 */ dup6 /* "#utility.yul":1345:1368 */ sub /* "#utility.yul":1341:1373 */ slt /* "#utility.yul":1338:1457 */ iszero tag_41 jumpi /* "#utility.yul":1376:1455 */ tag_42 tag_13 jump // in tag_42: /* "#utility.yul":1338:1457 */ tag_41: /* "#utility.yul":1496:1497 */ 0x00 /* "#utility.yul":1521:1582 */ tag_43 /* "#utility.yul":1574:1581 */ dup6 /* "#utility.yul":1565:1571 */ dup3 /* "#utility.yul":1554:1563 */ dup7 /* "#utility.yul":1550:1572 */ add /* "#utility.yul":1521:1582 */ tag_18 jump // in tag_43: /* "#utility.yul":1511:1582 */ swap3 pop /* "#utility.yul":1467:1592 */ pop /* "#utility.yul":1631:1633 */ 0x20 /* "#utility.yul":1657:1710 */ tag_44 /* "#utility.yul":1702:1709 */ dup6 /* "#utility.yul":1693:1699 */ dup3 /* "#utility.yul":1682:1691 */ dup7 /* "#utility.yul":1678:1700 */ add /* "#utility.yul":1657:1710 */ tag_21 jump // in tag_44: /* "#utility.yul":1647:1710 */ swap2 pop /* "#utility.yul":1602:1720 */ pop /* "#utility.yul":1237:1727 */ swap3 pop swap3 swap1 pop jump // out auxdata: 0xa2646970667358221220ff8b5c8ba37ef051a68ed77f5f39ad93423518f814bd59c16c9d1c94948a358c64736f6c63430008100033 } ``` --- # How to use slither to audit smart contracts URL: https://pentestwiki.org/blockchain/how-to-use-slither-to-audit-smart-contracts/ Published: 2022-07-23 | Updated: 2026-11-26 Category: Blockchain | Tags: slither, smart contracts, solidity, web3 Slither is a Solidity static analysis framework written in Python 3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses. Prerequisites: You will need solc from Ethereum: Install solc first, for example with pip3 install solc-select && solc-select install 0.8.17 && solc-select use 0.8.17. Now we can install slither directly using pip: ``` # pip3 install slither-analyzer ``` Interested in a Smart Contract or Web3 audit? See our smart contract audit service. Let’s see how it works, the syntax in very easy, just point to the directory where the smart contracts are: ``` ~/simple-auction$ slither . Compilation warnings/errors on ./simple-auction.sol: Warning: This is a pre-release compiler version, please do not use it in production. SimpleAuction.constructor(uint256,address).beneficiaryAddress (simple-auction.sol#46) lacks a zero-check on : - beneficiary = beneficiaryAddress (simple-auction.sol#48) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#missing-zero-address-validation SimpleAuction.bid() (simple-auction.sol#56-87) uses timestamp for comparisons Dangerous comparisons: - block.timestamp > auctionEndTime (simple-auction.sol#65) SimpleAuction.auctionEnd() (simple-auction.sol#112-138) uses timestamp for comparisons Dangerous comparisons: - block.timestamp < auctionEndTime (simple-auction.sol#127) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp solc-0.8.14 is not recommended for deployment Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-versions-of-solidity . analyzed (1 contracts with 77 detectors), 4 result(s) found ``` Pros: - Good recommendations using an automatic tool Cons: - Difficult setup (relies on underlying solc version), tons of incompatibilities - Very bad UI: Critical in red, otherwise default color. No formatting. ### Extended usage: ``` $ slither --help usage: slither target [flag] target can be: - file.sol // a Solidity file - project_directory // a project directory. See https://github.com/crytic/crytic-compile/#crytic-compile for the supported platforms - 0x.. // a contract on mainet - NETWORK:0x.. // a contract on a different network. Supported networks: mainet,ropsten,kovan,rinkeby,goerli,tobalaba,bsc,testnet.bsc,arbi,testnet.arbi,poly,avax,testnet.avax,ftm For usage information, see https://github.com/crytic/slither/wiki/Usage optional arguments: -h, --help show this help message and exit --version displays the current version Compile options: --compile-force-framework COMPILE_FORCE_FRAMEWORK Force the compile to a given framework (solc,truffle,embark,dapp,etherlime,etherscan,vyper,waffle,brownie,solc- json,buidler,hardhat,standard,archive) --compile-remove-metadata Remove the metadata from the bytecodes --compile-custom-build COMPILE_CUSTOM_BUILD Replace platform specific build command --ignore-compile Do not run compile of any platform Solc options: --solc SOLC solc path --solc-remaps SOLC_REMAPS Add remapping --solc-args SOLC_ARGS Add custom solc arguments. Example: --solc-args "--allow-path /tmp --evm-version byzantium". --solc-disable-warnings Disable solc warnings --solc-working-dir SOLC_WORKING_DIR Change the default working directory --solc-solcs-select SOLC_SOLCS_SELECT Specify different solc version to try (env config). Depends on solc-select --solc-solcs-bin SOLC_SOLCS_BIN Specify different solc version to try (path config). Example: --solc-solcs-bin solc-0.4.24,solc-0.5.3 --solc-standard-json Compile all specified targets in a single compilation using solc standard json --solc-force-legacy-json Force the solc compiler to use the legacy json ast format over the compact json ast format Truffle options: --truffle-ignore-compile Do not run truffle compile --truffle-build-directory TRUFFLE_BUILD_DIRECTORY Use an alternative truffle build directory --truffle-version TRUFFLE_VERSION Use a local Truffle version (with npx) --truffle-overwrite-config Use a simplified version of truffle-config.js for compilation --truffle-overwrite-version TRUFFLE_OVERWRITE_VERSION Overwrite solc version in truffle-config.js (only if --truffle-overwrite-config) Embark options: --embark-ignore-compile Do not run embark build --embark-overwrite-config Install @trailofbits/embark-contract-export and add it to embark.json Dapp options: --dapp-ignore-compile Do not run dapp build Etherlime options: --etherlime-ignore-compile Do not run etherlime compile --etherlime-compile-arguments Add arbitrary arguments to etherlime compile (note: [dir] is the the directory provided to crytic-compile) Etherscan options: --etherscan-only-source-code Only compile if the source code is available. --etherscan-only-bytecode Only looks for bytecode. --etherscan-apikey ETHERSCAN_API_KEY Etherscan API key. --arbiscan-apikey ARBISCAN_API_KEY Etherscan API key. --polygonscan-apikey POLYGONSCAN_API_KEY Etherscan API key. --avax-apikey AVAX_API_KEY Etherscan API key. --ftmscan-apikey FTMSCAN_API_KEY Etherscan API key. --bscan-apikey BSCAN_API_KEY Etherscan API key. --etherscan-export-directory ETHERSCAN_EXPORT_DIR Directory in which to save the analyzed contracts. Waffle options: --waffle-ignore-compile Do not run waffle compile --waffle-config-file WAFFLE_CONFIG_FILE Provide a waffle config file NPX options: --npx-disable Do not use npx Buidler options: --buidler-ignore-compile Do not run buidler compile --buidler-cache-directory BUIDLER_CACHE_DIRECTORY Use an alternative buidler cache directory (default ./cache) --buidler-skip-directory-name-fix Disable directory name fix (see https://github.com/crytic/crytic-compile/issues/116) hardhat options: --hardhat-ignore-compile Do not run hardhat compile --hardhat-cache-directory HARDHAT_CACHE_DIRECTORY Use an alternative hardhat cache directory (default ./cache) --hardhat-artifacts-directory HARDHAT_ARTIFACTS_DIRECTORY Use an alternative hardhat artifacts directory (default ./artifacts) Detectors: --detect DETECTORS_TO_RUN Comma-separated list of detectors, defaults to all, available detectors: abiencoderv2-array, arbitrary-send, array-by-reference, controlled-array-length, assembly, assert-state-change, backdoor, weak-prng, boolean-cst, boolean-equal, shadowing-builtin, constable- states, constant-function-asm, constant-function-state, pragma, controlled-delegatecall, costly-loop, dead-code, delegatecall-loop, deprecated-standards, divide-before-multiply, enum-conversion, external-function, function-init-state, erc20-interface, erc721-interface, solc-version, incorrect-equality, incorrect-unary, shadowing-local, locked-ether, low-level-calls, mapping-deletion, events-access, events-maths, missing-inheritance, missing-zero-check, incorrect-modifier, msg-value-loop, calls-loop, multiple- constructors, name-reused, naming-convention, variable-scope, public-mappings-nested, redundant-statements, reentrancy-benign, reentrancy-eth, reentrancy-events, reentrancy-unlimited-gas, reentrancy-no-eth, reused-constructor, rtlo, shadowing-abstract, incorrect- shift, similar-names, shadowing-state, storage-array, suicidal, timestamp, too-many-digits, tx-origin, tautology, unchecked-lowlevel, unchecked-send, unchecked-transfer, unimplemented-functions, erc20-indexed, uninitialized-fptr-cst, uninitialized-local, uninitialized- state, uninitialized-storage, unprotected-upgrade, unused-return, unused-state, void-cst, write-after-write --list-detectors List available detectors --exclude DETECTORS_TO_EXCLUDE Comma-separated list of detectors that should be excluded --exclude-dependencies Exclude results that are only related to dependencies --exclude-optimization Exclude optimization analyses --exclude-informational Exclude informational impact analyses --exclude-low Exclude low impact analyses --exclude-medium Exclude medium impact analyses --exclude-high Exclude high impact analyses --show-ignored-findings Show all the findings Printers: --print PRINTERS_TO_RUN Comma-separated list fo contract information printers, available printers: cfg, constructor-calls, contract-summary, data-dependency, echidna, function-id, function-summary, modifiers, call-graph, evm, human-summary, inheritance, inheritance-graph, slithir, slithir-ssa, vars-and-auth, require, variable-order --list-printers List available printers Additional options: --json JSON Export the results as a JSON file ("--json -" to export to stdout) --sarif SARIF Export the results as a SARIF JSON file ("--sarif -" to export to stdout) --json-types JSON_TYPES Comma-separated list of result types to output to JSON, defaults to detectors,printers. Available types: compilations,console,detectors,printers,list-detectors,list-printers --zip ZIP Export the results as a zipped JSON file --zip-type ZIP_TYPE Zip compression type. One of lzma,stored,deflated,bzip2. Default lzma --markdown-root MARKDOWN_ROOT URL for markdown generation --disable-color Disable output colorization --filter-paths FILTER_PATHS Comma-separated list of paths for which results will be excluded --triage-mode Run triage mode (save results in slither.db.json) --config-file CONFIG_FILE Provide a config file (default: slither.config.json) --solc-ast Provide the contract as a json AST --generate-patches Generate patches (json output only) ``` Dirty hack to avoid @openzeppelin import errors: ``` slither contract.sol --solc-remaps @=../node_modules/@ ``` --- # FAQ URL: https://pentestwiki.org/faq/ Answers to the questions we hear most often about pentestwiki.org, learning penetration testing legally, and our professional services. ## Learning & content Is everything on pentestwiki.org really free?Yes. All tutorials, cheat sheets and browser tools are free to read and use. We also offer paid professional services (audits, pentests, training) for teams that need an expert assessment, but the learning material is and will stay free. Is it legal to practise these techniques?Practising on systems you own, on deliberately vulnerable labs, or on CTF platforms is legal and encouraged. Testing systems you don't own without written permission is illegal in most countries. Everything we publish assumes authorized testing — see our disclaimer. I'm a complete beginner. Where do I start?Start with the academy learning path and set up a safe lab with intentionally vulnerable applications. Build infrastructure and web fundamentals first, then branch into mobile, cloud, red teaming or blockchain. How current is the content?We revisit guides as tools and standards change and date every update. See our editorial policy for how we research and review. Do you cover Web3 / smart contract security?Extensively. We have guides on EVM internals and on Slither, Surya, Mythril, Echidna and Foundry, plus analyses of DeFi vulnerability classes like the ERC-4626 inflation attack. ## Services What services do you offer?Smart contract audits, web, mobile and cloud penetration tests, red team / Active Directory assessments, and a Web3 security bootcamp. See the services page. How much does an audit or pentest cost?It depends on scope — codebase size, number of applications, chains, and depth. Each listing shows a starting price; the final quote follows a short scoping call. Request a quote to get started. Do you sign an NDA?Yes. We sign an NDA and agree written rules of engagement before any testing begins. Do you re-test after we fix the findings?Yes — a re-test of the remediated findings and an updated report are included. What payment methods do you accept?Card payments via our checkout, and bank transfer for larger engagements. See the refund & cancellation policy. ## Privacy & security What do you do with my contact details?We use them only to answer your request, as described in our privacy policy. We don't sell data. I found a vulnerability on this site. How do I report it?Thank you — please follow our responsible disclosure policy. We offer safe harbour for good-faith research. Do the browser tools send my data anywhere?No. The encoder, hash generator, JWT decoder and password checker run entirely in your browser; nothing is transmitted to us.