├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── contributors.json ├── mapping.json ├── oswar ├── collection │ ├── off-chain_osint.md │ └── on-chain_osint.md ├── command_and_control │ ├── botnets.md │ └── fake_or_compromised_validator_nodes.md ├── credential_access │ ├── exchange_account_theft.md │ ├── identity_spoofing.md │ ├── private_key_theft.md │ └── social_media_credential_theft.md ├── defense_evasion │ ├── chain_hopping.md │ ├── coinjoin_transaction.md │ ├── encryption.md │ ├── mixing_services.md │ └── obfuscation.md ├── discovery │ ├── api_discovery.md │ └── dumpster_diving.md ├── execution │ ├── 51_attack.md │ ├── access_control_issues.md │ ├── bad_randomness.md │ ├── block_timestamp_manipulation.md │ ├── check-effect_interaction.md │ ├── constructors_with_care.md │ ├── cross-chain_bridge_attacks.md │ ├── crypto-jacking.md │ ├── default_visibility.md │ ├── delegate_call.md │ ├── denial_of_service_(dos).md │ ├── dependency_risks.md │ ├── entropy_illusion_predictability.md │ ├── external_contract_referencing.md │ ├── flash_loan_(amm exploitation).md │ ├── floating_pragma.md │ ├── force_feeding.md │ ├── integer_overflow_underflow.md │ ├── logic_bombs.md │ ├── mev.md │ ├── mirroring_attack.md │ ├── oracle_attack.md │ ├── outdated_compiler.md │ ├── reentrancy.md │ ├── self-destruct.md │ ├── semantic_errors.md │ ├── short_address_parameter_attack.md │ ├── smart_contract_vulnerabilities.md │ ├── state_variable_default_visibility_vulnerability.md │ ├── time_manipulation.md │ ├── token_supply_manipulation.md │ ├── tx_origin_authentication.md │ ├── unchecked_return_values.md │ ├── unexpected_ether.md │ └── uninitialized_storage_pointers.md ├── exfiltration │ ├── atomic_swaps.md │ └── privacy_solutions_like_monero.md ├── gas_vulnerabilities │ ├── DoS-gas-limit.md │ ├── gas_griefing.md │ └── test.md ├── impact │ ├── data_destruction.md │ ├── disrupt_system_operation.md │ ├── eclipse_attack.md │ ├── front-running.md │ ├── network_shutdown.md │ ├── spartacus_attack.md │ └── sybil_attack.md ├── initial_access │ ├── Proxy_Phishing_NFTs │ ├── Proxy_Phishing_NFTs.md │ ├── dns_hijacking.md │ ├── forged_address_phishing.md │ ├── malicious_code_injection.md │ ├── malware.md │ ├── on-chain_scams.md │ ├── phishing.md │ ├── server_access.md │ ├── validator_priviliges.md │ └── zero_transfer_phishing.md ├── lateral_movement │ ├── bridge_exploits.md │ ├── compromised_nodes.md │ └── multi-chain_attacks.md ├── persistence │ ├── backdoor.md │ ├── contract_ownership_changes.md │ ├── malicious_smart_contracts.md │ └── rugpull.md ├── privilege_escalation │ ├── blockchain_node_hijacking.md │ ├── governance_exploit_(dao_takeover).md │ ├── guardian_takeover.md │ └── smart_contract_ownership_override.md ├── reconnaissance │ ├── api_endpoints.md │ ├── malware.md │ ├── smart_contract_scanning.md │ └── social_engineering_one.md └── resource_development │ ├── brute_force_attack.md │ ├── credential_stuffing.md │ ├── keylogger.md │ ├── malware.md │ ├── network_profiling.md │ ├── phishing_for_information.md │ ├── resources_for_network-based_attacks.md │ ├── social_engineering.md │ └── spear_phishing.md └── oswar_og.png /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering a safe and welcoming environment, we, as 6 | the CyVers-AI team, pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity, gender expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Use welcoming and inclusive language 18 | * Respect each other 19 | * Provide and gracefully accept constructive criticism 20 | * Show empathy towards other community members 21 | 22 | Examples of unacceptable behavior by participants include: 23 | 24 | * Trolling, insulting/derogatory comments, and personal or political attacks 25 | * Public or private harassment 26 | * Publishing others' private information, such as a physical or electronic 27 | address, without explicit permission 28 | * The use of sexualized language or imagery 29 | * Unwelcome sexual attention or advances 30 | * Other conduct which could reasonably be considered inappropriate in a 31 | professional setting 32 | 33 | ## Our Responsibilities 34 | 35 | The CyVers-AI team are responsible for clarifying the standards of acceptable 36 | behavior and are expected to take appropriate and fair corrective action in 37 | response to any instances of unacceptable behavior. 38 | 39 | The CyVers-AI team have the right and responsibility to remove, edit, or 40 | reject comments, commits, code, wiki edits, issues, and other contributions 41 | that are not aligned to this Code of Conduct, and to ban temporarily or 42 | permanently any contributor for other behaviors that they deem inappropriate, 43 | threatening, offensive, or harmful. 44 | 45 | ## Scope 46 | 47 | This Code of Conduct applies to all CyVers-AI communication channels - online or in person, 48 | and it also applies when an individual is representing the project or its community in 49 | public spaces. Examples of representing a project or community include using an official 50 | project e-mail address, posting via an official social media account, or acting 51 | as an appointed representative at an online or offline event. Representation of 52 | a project may be further defined and clarified by project maintainers. 53 | 54 | ## Enforcement 55 | 56 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 57 | reported by contacting the CyVers-AI team at info@cyvers.ai. All 58 | complaints will be reviewed and investigated and will result in a response that 59 | is deemed necessary and appropriate to the circumstances. The CyVers-AI team 60 | will maintain confidentiality with regard to the reporter of an incident. 61 | Enforcement may result in an indefinite ban from all official CyVers-AI communication 62 | channels, or other actions as deemed appropriate by the CyVers-AI team. 63 | 64 | CyVers-AI maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🔐 OSWAR (Open Standard Web3 Attack Reference) 2 | 3 | OSWAR is a comprehensive framework inspired by the **MITRE ATT&CK framework**, designed to identify, categorize, and mitigate `Web3`-related attacks and vulnerabilities. It provides a structured and actionable understanding of attacker behaviors, techniques, and vulnerabilities specific to decentralized systems such as blockchain platforms and decentralized applications (dApps). 4 | ### Join the community today 😉 5 | - **Telegram** : https://t.me/oswarcommunity 6 | - **LinkedIn**: https://www.linkedin.com/company/oswar/ 7 | 8 | ![OSWAR](oswar_og.png) 9 | 10 | -------------------- 11 | 12 | ## 🎯 Purpose 13 | 14 | - The primary goal of OSWAR is to foster a **safer and more secure ecosystem** for the future of decentralization. 15 | - By offering detailed information and guidance on securing blockchain platforms, decentralized applications, and other Web3 technologies. 16 | - OSWAR aims to **empower developers, auditors, and security researchers** with the knowledge they need to defend against potential threats. 17 | 18 | ## 🔥 Features 19 | 20 | - **Comprehensive Attack Catalog**: OSWAR provides an extensive catalog of Web3-related attacks and vulnerabilities, organized into categories for easy navigation and reference. 21 | - **Attack Techniques and Tactics**: Each attack in the catalog is accompanied by detailed information about the techniques and tactics employed by attackers, helping users gain a deeper understanding of potential threats. 22 | - **Mitigation Strategies**: OSWAR offers actionable guidance and best practices to mitigate each identified attack, providing developers and security practitioners with effective countermeasures. 23 | - **Community Collaboration**: OSWAR is an open standard framework, `encouraging collaboration and contributions from the Web3 community` to enhance the knowledge base and improve the overall security of decentralized systems. 24 | 25 | ## ✍️ Getting Started 26 | 27 | - To explore various categories of attacks, visit **[oswar.org](https://www.oswar.org/)** 28 | - Each category provides information about different types of attacks. 29 | - Once you `select a category`, you can choose a specific vulnerability to read about. 30 | - If you have a `new attack type` to contribute, you can click on **"Add Attack"** and make the necessary changes on the corresponding GitHub page. 31 | - This will allow you to submit your new attack for publication. 32 | - If you find any **inaccuracies** or feel that changes are needed in the content of an existing vulnerability, you can click on the `"EDIT"` button at the bottom of the page. This will redirect you to the corresponding GitHub page where you can make the necessary modifications. 33 | - After making the changes, you can raise a **Pull Request on the GitHub** repository for review. 34 | 35 | > Congratulations! You've successfully submitted your PR for review and publishing 🚀 36 | 37 | ## ✨ Feedback & Suggestions 38 | If you have any suggestions/feedback, you can contact us via [Telegram Community](https://t.me/oswarcommunity). Alternatively, feel free to open an issue if you find bugs or want to request new features. 39 | 40 | -------- 41 | 42 | By leveraging the OSWAR framework, we can collectively enhance the security of Web3 technologies, making the decentralized ecosystem more resilient against attacks. Together, we can build a safer and more secure future for decentralization. 43 | -------------------------------------------------------------------------------- /oswar/collection/off-chain_osint.md: -------------------------------------------------------------------------------- 1 | # 2. Off-chain OSINT 2 | 3 | Category: Analysis & profiling 4 | Tags: Collection 5 | 6 | ### What is “Off-chain OSINT”? 7 | 8 | Off-chain OSINT (Open-Source Intelligence) is a category in the OSWAR framework that refers to the process of gathering publicly available information from off-chain sources to analyze and identify potential security threats or vulnerabilities in the Web3 ecosystem. 9 | This involves collecting and analyzing information from various sources, such as social media, forums, blogs, news articles, and developer repositories, to gain insight into potential attack vectors, security issues, or vulnerabilities related to Web3 applications and infrastructure. This information can be valuable for attackers to identify weak points. 10 | 11 | ### Example: 12 | 13 | An attacker might use off-chain OSINT to monitor discussions on developer forums or social media channels to identify potential vulnerabilities in a popular DeFi protocol. They could come across a developer mentioning a possible exploit in the smart contract code that has not been patched yet. This information could then be used by the researcher to analyze the vulnerability and recommend appropriate mitigations to the protocol's team or the wider community. 14 | 15 | ### Mitigation: 16 | 17 | To mitigate the risks associated with off-chain OSINT, several steps can be taken: 18 | 19 | 1. Be cautious about sharing sensitive information: Developers, team members, and users should be mindful of the information they share on public platforms. Revealing too much information about a project's security mechanisms, known vulnerabilities, or internal processes can expose the project to potential attacks. 20 | 2. Monitor public discussions: Actively monitor public forums, social media channels, and other online platforms where your project or technology is being discussed. This can help you identify potential security issues, vulnerabilities, or attack vectors before they are exploited. 21 | 3. Implement secure coding practices: Ensure that your smart contracts and other code are developed using secure coding practices, such as adhering to established security guidelines, performing regular code reviews, and using automated testing tools to identify and fix vulnerabilities. 22 | 4. Establish a vulnerability disclosure program: Encourage responsible disclosure of security vulnerabilities by setting up a clear process for reporting and addressing potential issues. This can help ensure that vulnerabilities are addressed in a timely manner before they can be exploited. 23 | 5. Educate your team and community: Provide security awareness training to your team and educate your user community on best practices for protecting their assets and interactions with your project. This can help reduce the risk of social engineering attacks and other security issues arising from off-chain OSINT. -------------------------------------------------------------------------------- /oswar/collection/on-chain_osint.md: -------------------------------------------------------------------------------- 1 | # 1. On-chain OSINT 2 | 3 | Category: Analysis & profiling 4 | Tags: Collection 5 | 6 | ### What is On-chain OSINT? 7 | 8 | On-chain OSINT, another way of referencing blockchain OSINT is also known as "Open-Source Intelligence," which involves collecting and analyzing data from open sources, both covert and publicly available. 9 | 10 | Since blockchain data, such as transactions, is publicly available, attackers can use blockchain analysis tools to trace transactions, identify wallet addresses, and uncover other sensitive data related to blockchain users. This technique is often used in the collection phase of a web3 hack. By using publicly available blockchain analysis tools, hackers can go through a lot of data to identify a protocol, DApp, or target in general. 11 | 12 | ### Example 13 | 14 | Attackers can use blockchain analysis to track transactions and identify the parties involved, including wallet addresses and other sensitive data. This information can be used to exploit vulnerabilities in the system, launch phishing attacks, or steal cryptocurrency. However, it can also be as simple as examining certain protocols' Total Value Locked (TVL) to further identify a target. 15 | 16 | An attacker might use blockchain analysis to identify the owners of substantial amounts of cryptocurrency and then use social engineering techniques to trick them into revealing their private keys or other sensitive information. Additionally, attackers can collect information on dApps, such as their smart contract code, user data, transaction history, volume, and more. 17 | 18 | ### Mitigation 19 | 20 | Unfortunately, it is not possible to prevent on-chain OSINT entirely because blockchain technology is designed to be transparent and decentralized. However, some measures can be taken to reduce the risk of attacks, such as using privacy-enhancing technologies like mixers or tumblers to obfuscate transactions and prevent tracking. Additionally, users can take steps to protect their private keys and other sensitive information, such as using hardware wallets or secure storage solutions. -------------------------------------------------------------------------------- /oswar/command_and_control/botnets.md: -------------------------------------------------------------------------------- 1 | # 2. Botnets 2 | 3 | Category: Infrastructure 4 | Tags: Command and Control 5 | 6 | Botnets are networks of infected devices controlled by a single attacker. In Web3, botnets can launch Distributed Denial of Service (DDoS) attacks on blockchain-based networks, disrupting their operations and potentially causing financial losses to their users. 7 | 8 | Botnets are a network of compromised devices, typically controlled by a single attacker or group of attackers, that can be used to conduct malicious activities such as spamming, distributed denial-of-service attacks, and data theft. In the context of the command and control section of the framework for Web3, botnets are often used to control the operation of malicious software on compromised devices. 9 | 10 | Example 11 | 12 | A common example of a botnet involves an attacker infecting many devices with malware, which allows the attacker to take control of the devices and use them to conduct malicious activities. The infected devices can be used to carry out distributed denial-of-service attacks, send spam emails, or steal sensitive data. The attacker can use a command and control (C2) server to communicate with the infected devices, issuing commands to carry out specific tasks or to receive information from the compromised devices. 13 | 14 | Mitigation 15 | 16 | Mitigating the threat botnets poses requires a combination of technical and non-technical measures. Technical measures include implementing network security controls such as firewalls and intrusion detection/prevention systems, using anti-malware software to detect and remove malware infections, and configuring systems to block traffic to known C2 servers. 17 | 18 | Non-technical measures include educating users on identifying and avoiding attacks, ensuring that software and operating systems are kept up-to-date with security patches, and implementing strict access control policies to limit the damage caused by a compromised account or device. 19 | 20 | DNS Firewall Threat Feeds can be used to choke botnets and automatically prevent users from accessing malware dropper and phishing sites. Additionally, implementing IP address restrictions using Classless Inter-Domain Routing (CIDR) notation can help to block traffic from known malicious IP addresses and ranges. Another possible mitigation strategy is to implement process mitigations such as Data Execution Prevention (DEP), which can help to prevent buffer overrun exploitation by marking certain regions of memory as non-executable. 21 | 22 | In summary, botnets pose a significant threat in the context of the command and control section of the framework for Web3. Combating this threat requires a combination of technical and non-technical measures, including network security controls, anti-malware software, access control policies, and user education. Implementing process mitigations and IP address restrictions can also be effective strategies for blocking traffic from known malicious sources. -------------------------------------------------------------------------------- /oswar/command_and_control/fake_or_compromised_validator_nodes.md: -------------------------------------------------------------------------------- 1 | # 1. Fake or compromised validator nodes 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Command and Control 5 | 6 | What are “fake or compromised validator nodes”? 7 | 8 | Fake or compromised validator nodes attack a blockchain network where malicious actors create fake nodes that appear legitimate validators. These nodes can then be used to gain control of the blockchain network and carry out various attacks, such as injecting fake transactions, censoring valid transactions, or manipulating the consensus mechanism. 9 | 10 | Malicious actors can create fake validator nodes to gain control of a blockchain network. They can use these nodes to inject fake transactions, censor valid transactions, or manipulate the blockchain's consensus mechanism. 11 | 12 | Creating fake validator nodes on a blockchain network can involve the attacker owning a significant amount of the cryptocurrency or asset associated with that network, which they can use to purchase the necessary equipment and set up the validator nodes. However, it is only sometimes needed for the attacker to own the asset or currency to set up the fake validator nodes. 13 | 14 | The possibility of the attacker getting slashed for malicious activity depends on the specific blockchain network's consensus mechanism and governance model. Some blockchain networks have penalty mechanisms in place, where malicious behavior by a validator node can result in the node being removed from the network or having a portion of its stake or rewards slashed. However, it is possible that the attacker could evade such penalties by disguising their malicious activity or using a decentralized governance model where there is no central authority to enforce penalties. 15 | 16 | It is important to note that creating fake validator nodes can cause significant harm to the blockchain network and its users. 17 | 18 | Example 19 | 20 | An attacker might create many fake validator nodes and use them to gain most of the votes in a proof-of-stake (PoS) consensus mechanism. This would allow the attacker to control the validation process and potentially carry out attacks such as double-spending or reorganizing the blockchain. 21 | 22 | Mitigation 23 | 24 | To mitigate this type of attack, blockchain networks can implement various security measures such as: 25 | 26 | KYV (Know Your Validator): Validating the identity of all validators to ensure they are legitimate. 27 | 28 | Multi-party computation: This involves breaking up sensitive data and computations into multiple parts, each processed by different validators, to prevent any single validator from having complete control. 29 | 30 | Decentralized Governance: Implementing a governance model that allows for community decision-making and voting rights. 31 | 32 | Security Audits: Conducting regular security audits to identify and address vulnerabilities in the blockchain network. 33 | 34 | Consensus Mechanism Diversity: Using multiple consensus mechanisms that work together to provide stronger security and resilience against attacks. -------------------------------------------------------------------------------- /oswar/credential_access/exchange_account_theft.md: -------------------------------------------------------------------------------- 1 | # 3. Exchange Account Theft 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Credential Access 5 | 6 | What us “Exchange Account Theft”? 7 | 8 | Web3 exchanges often require users to create accounts and provide sensitive information, such as personal identification and bank account details. Malicious actors can use phishing or social engineering to steal exchange account credentials, which can be used to steal funds or make fraudulent trades. Exchange account theft is also related to the last phase of an attack: money laundering. In this phase, hackers use fake identities or exchange accounts to withdraw funds into a bank account or elsewhere. 9 | 10 | Therefore, it is important to be cautious when providing personal information on Web3 exchanges and to take steps to protect your account. One way to do this is to avoid clicking on suspicious links or providing personal information to unsolicited sources. Additionally, you can enable two-factor authentication for added security. 11 | 12 | To prevent Web3 exchange account theft, it is important to be cautious when providing personal information, avoid suspicious links, and enable two-factor authentication. Malicious actors can use phishing, social engineering, or malware to steal login credentials, which can be used for fraudulent trades or stealing funds. 13 | 14 | ### Example 15 | 16 | An instance of exchange account theft in 2019 was the Binance hack, in which hackers utilized various methods, such as phishing attacks and malware, to steal 7,000 BTC valued at approximately $40 million. 17 | 18 | Source: [https://www.bloomberg.com/news/articles/2019-05-08/crypto-exchange-giant-binance-reports-a-hack-of-7-000-bitcoin](https://www.bloomberg.com/news/articles/2019-05-08/crypto-exchange-giant-binance-reports-a-hack-of-7-000-bitcoin) 19 | 20 | ### Mitigation 21 | 22 | To reduce the risk of exchange account theft, Web3 exchange platforms should implement robust security measures such as two-factor authentication, IP address whitelisting, and regular security audits. Exchange users should also take steps to safeguard their accounts, such as using strong passwords and avoiding sharing their login credentials with others. Additionally, users should be cautious of suspicious emails or messages and refrain from clicking on links or downloading files from unknown sources. 23 | 24 | Furthermore, Web3 exchanges need to comply with regulatory requirements, including Anti-Money Laundering (AML) and Know Your Customer (KYC) regulations. These regulations require that exchanges authenticate their users' identities and monitor their transactions to identify any suspicious activities that may indicate money laundering or other illicit activities. 25 | 26 | All in all, exchange account theft poses a grave threat to the security of Web3 exchanges and can lead to significant financial losses for users. It is crucial for exchange platforms and users alike to proactively take measures to prevent such attacks from happening. -------------------------------------------------------------------------------- /oswar/credential_access/identity_spoofing.md: -------------------------------------------------------------------------------- 1 | # 4. Identity Spoofing 2 | 3 | Category: User Target 4 | Tags: Credential Access 5 | 6 | ### What is Identity spoofing? 7 | 8 | Identity spoofing is a cyber-attack where someone creates a false identity or impersonates a legitimate entity to gain access to sensitive information or accounts. It is important to implement identity verification processes and conduct regular audits to prevent such fraudulent activity. Attackers may use tactics like phishing emails, social engineering, or tools to create fake online identities. By being vigilant and taking appropriate precautions, such attacks can be mitigated. 9 | 10 | ### Example 11 | 12 | In Web3, identity spoofing can pose a significant threat as it may result in the loss of cryptocurrencies or other digital assets. For instance, an attacker could fabricate a false identity on a social media platform or messaging app and exploit it to establish trust with the victim. Once trust is established, the attacker can request sensitive information, such as private keys or login credentials, which can be used to gain unauthorized access to the victim's digital assets. 13 | 14 | ### Mitigation 15 | 16 | To avoid identity theft, it's essential to use robust authentication methods and educate users on how to recognize and report suspicious activity. This may involve implementing multi-factor authentication, designating trusted contacts, and exercising caution when divulging personal information online. Regular security audits are also necessary to pinpoint and resolve system vulnerabilities. -------------------------------------------------------------------------------- /oswar/credential_access/private_key_theft.md: -------------------------------------------------------------------------------- 1 | # 1. Private Key Theft 2 | 3 | Category: Acquire Private Key 4 | Tags: Credential Access 5 | 6 | ### What is “private key” theft? 7 | 8 | (This section does overlap with a lot of other sections.) Private keys are the main credentials used to access and manage Web3 assets, which include cryptocurrencies, NFTs, and smart contracts. Malicious actors may attempt to steal users' private keys through phishing, social engineering, or malware. 9 | 10 | ### Example 11 | 12 | The Ronin Network hack of 2022 is an example of a Guardian Takeover attack. 13 | 14 | Axie Infinity, a popular blockchain gaming application, was developed on the Ronin Network. Regrettably, Ronin experienced one of its worst hacks in March 2022, when a malicious actor rapidly obtained 173,600 ether ($ETH) and 25.5 million USDC, which were later exchanged for $625 million. The hacker acquired the necessary private keys and consequently stole all the funds from the Ronin Bridge in just two transactions, making it one of the most significant DeFi breaches. 15 | 16 | The Ronin Bridge had nine "validators" operating it, with a five out of nine thresholds. Sky Mavis, the company behind Axie Infinity, oversaw four validators, so the private keys needed to be distributed more. Additionally, Axie delegated their validator's signature to Sky Mavis in November 2021. While this delegation was meant to be temporary due to the heavy traffic Axie was experiencing, it was never revoked. Sky Mavis ended up with five validator signatures, enough to approve any message. Through a social-engineering attack, the attacker gained control of the keys. They could call withdrawERC from the bridge without a backing transaction on the other side once they had the keys. 17 | 18 | ### Mitigation 19 | 20 | Private key theft is a critical security issue in the blockchain and cryptocurrency world. It can result in the loss of funds and compromise the security of a blockchain network. Below are some practical ways to prevent private key theft while securing your crypto assets: 21 | 22 | - Use a hardware wallet: A physical device stores your private keys offline, making it more challenging for hackers to access them. It is one of the most secure ways to store your private keys. 23 | - Use a software wallet with two-factor authentication: If you use a software wallet to store your private keys, enable two-factor authentication (2FA) to add an extra layer of security. This will require a code generated by an app or text message in addition to your password to access your wallet. 24 | - Use a strong password: Create a strong, unique password for your wallet and change it regularly. Avoid using easily guessable passwords, such as common words or phrases, birthdates, or pet names. 25 | - Keep your private keys offline: Consider printing and storing them in a secure physical location, such as a safe or safety deposit box. This ensures that your private keys are not stored on a computer or device that can be hacked. 26 | - Avoid phishing scams: Be wary of phishing scams that trick you into giving away your private keys. Only enter your private keys on trusted and secure websites. 27 | - Regularly update your software: Keep your wallet software up-to-date with the latest security patches and updates to address any vulnerabilities. 28 | - Use a multi-signature scheme: DApps can implement multi-signature schemes requiring multiple private keys to authorize a transaction. This adds an extra layer of security and reduces the risk of private key theft. 29 | 30 | The best way to prevent private key theft is to stay vigilant and take proactive steps to secure your private keys. You can significantly reduce the risk of private key theft by using a combination of hardware and software wallets, two-factor authentication, strong passwords, offline storage, and regular updates. -------------------------------------------------------------------------------- /oswar/credential_access/social_media_credential_theft.md: -------------------------------------------------------------------------------- 1 | # 2. Social Media Credential Theft 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Credential Access 5 | 6 | ### What is Social Media Credential Theft? 7 | 8 | Social media platforms are often used by Web3 projects to engage communities and promote their projects. However, malicious actors may use phishing or social engineering techniques to steal social media credentials, including usernames and passwords. These stolen credentials can then be used to impersonate legitimate accounts, spread misinformation, conduct scams, or carry out other malicious activities. 9 | 10 | Social media credential theft refers to stealing social media account login credentials through malicious means such as phishing, social engineering, or malware. 11 | 12 | Social media credential theft is common in Web3 projects and NFT discords. Hackers may target community members of a particular Web3 project or NFT discord to steal their social media credentials and gain access to their accounts. Once the hacker gains access to these accounts, they can then impersonate legitimate users to spread misinformation or conduct scams related to the Web3 project or NFT discord. 13 | 14 | ### Example 15 | 16 | One instance of credential theft involves the Discord credential theft of an NFT project. In this scenario, hackers used a phishing scam to deceive users into divulging their login credentials for the NFT project's Discord server. Using these credentials, the hackers were able to infiltrate the Discord server and impersonate authorized users to disseminate misleading information and perpetrate scams related to the NFT project. 17 | 18 | ### Mitigation 19 | 20 | To reduce social media credential theft risk, Web3 project teams and NFT Discord moderators must educate their community members about the dangers of phishing and social engineering scams. Encouraging users to use strong passwords, enable two-factor authentication, and avoid clicking suspicious links or downloading unknown files is also essential. Furthermore, project teams and moderators should monitor their social media accounts and NFT Discords for suspicious activity and take swift action to address potential security breaches. 21 | 22 | Overall, social media credential theft significantly threatens the security of Web3 projects and NFT Discords. All stakeholders must remain vigilant and take proactive measures to prevent such attacks. -------------------------------------------------------------------------------- /oswar/defense_evasion/chain_hopping.md: -------------------------------------------------------------------------------- 1 | # 4. Chain Hopping 2 | 3 | Category: Money Laundering 4 | Tags: Defense Evasion 5 | 6 | ### What is chain hopping? 7 | 8 | Chain hopping is a technique used by crypto money launderers to conceal the origin and destination of illicit funds. It involves moving funds from one cryptocurrency to another, often through multiple exchanges or wallets, to obscure the transaction trail. 9 | 10 | The basic idea behind chain hopping is to make it more difficult for investigators to trace the flow of funds. By moving funds through multiple cryptocurrencies, it becomes much harder to establish a clear line of ownership and track the final destination of the funds. One of the primary advantages of chain hopping is that it allows money launderers to take advantage of the relatively low transaction fees and high liquidity of certain assets. 11 | 12 | ### Example 13 | 14 | For example, hackers may use a low-fee cryptocurrency like Litecoin to move funds quickly and cheaply from wallet to wallet and then convert them into a more stable and widely accepted cryptocurrency like Bitcoin or Ethereum, moving funds across chains and wallets multiple times to try to hide their tracks. Additionally, it can be used to obscure the source of illicit funds. By moving funds through multiple exchanges or wallets, money launderers can make it appear that the funds come from multiple sources rather than a single source. 15 | 16 | The essence here is to move the funds as much as possible across chains so that it becomes difficult to trace. 17 | 18 | ### Mitigation 19 | 20 | Despite the apparent advantages, chain hopping is not foolproof. Investigators can still use various techniques to trace the flow of funds, including analyzing blockchain data, monitoring exchanges, and conducting traditional financial investigations. Additionally, some cryptocurrencies make chain-hopping more difficult. 21 | 22 | While chain hopping can be an effective tool for crypto money launderers, it is not without risks. As regulators and law enforcement agencies become more sophisticated in tracking cryptocurrency transactions, money launderers must continue evolving tactics to stay ahead of the curve. 23 | 24 | Strategies to prevent or detect it: 25 | 26 | - Monitoring network traffic: Monitoring network traffic for connections to known cryptocurrency exchanges and mixers can help to identify when a user is switching between different blockchain networks or cryptocurrencies. 27 | - Identifying transaction patterns: Analyzing transaction patterns on different blockchain networks can help to identify when a user is hopping between different networks or currencies. This can include monitoring for changes in transaction volume or frequency, as well as identifying transactions that use similar addresses or follow similar patterns. 28 | - Analysis of blockchain data: Analyzing blockchain data can help identify activity patterns indicative of chain hopping. This can include monitoring for large transfers of funds between different blockchain networks, as well as analyzing the addresses and transaction histories of known chain hoppers. 29 | - Collaboration with law enforcement: Working with law enforcement agencies can help to identify and track down chain hoppers. This can include sharing intelligence on the latest chain-hopping techniques and collaborating on investigations. 30 | 31 | Detecting chain hopping involves combining technical controls, analysis of blockchain data, and collaboration with law enforcement. By implementing these strategies, organizations can reduce the risk of fraud and other security incidents caused by chain hopping. -------------------------------------------------------------------------------- /oswar/defense_evasion/encryption.md: -------------------------------------------------------------------------------- 1 | # 3. Encryption 2 | 3 | Category: Money Laundering 4 | Tags: Defense Evasion 5 | 6 | ### What is "Encryption"? 7 | 8 | Encryption is the process of converting information into code to make it unreadable to unauthorized users. For example, it can help protect sensitive data during transmission or storage using a cryptographic key to transform plain text into ciphertext. 9 | 10 | Attackers can use encryption techniques to encrypt their communications and data. This can make it difficult for defenders to intercept and understand the attacker's communications. For example, attackers may use encryption to hide their IP addresses or the location of their command-and-control servers. 11 | 12 | ### Example 13 | 14 | Encryption is typically associated with mixer services and other privacy protocols and networks. For instance, if a hacker has stolen assets on the Ethereum network, their every transaction can and will be traced. They may use protocols like atomic swaps or non-KYC exchanges to swap the stolen assets into Monero. By using Monero, one of the most well-known privacy and encryption-focused cryptocurrencies, they can send transactions to other wallets and thereby cover their own tracks. 15 | 16 | ### Mitigation: 17 | 18 | Using Monero or other privacy-focused cryptocurrencies and encryption services can make it difficult to trace the flow of funds or communications during a hack. However, several mitigation strategies can be used to reduce the risk of these techniques being used to hide tracks: 19 | 20 | - Monitor for unusual network traffic: It's important to monitor network traffic for any unusual or suspicious activity, such as large amounts of encrypted traffic or traffic to known cryptocurrency exchanges or mixers. This can help identify potential hacks or data exfiltration attempts. 21 | - Collaboration with law enforcement: Working with law enforcement agencies can help track down and apprehend attackers who use Monero or other encryption services to hide their tracks. This can include sharing intelligence on the latest hacking techniques and collaborating on investigations. 22 | Overall, mitigation strategies for using Monero or other encryption services in a hack involve a combination of technical controls, user education, and collaboration with law enforcement. By implementing these strategies, organizations can reduce the risk of data breaches and other security incidents caused by these techniques. -------------------------------------------------------------------------------- /oswar/defense_evasion/mixing_services.md: -------------------------------------------------------------------------------- 1 | # 1. Mixing services 2 | 3 | Category: Money Laundering 4 | Tags: Defense Evasion 5 | 6 | **What are mixing services?** 7 | 8 | Mixer services are tools used by attackers, such as Tornado Cash, to conceal their transactions and make it difficult to trace their actions on the blockchain. This can pose a challenge for defenders in tracking and blocking the attack. Mixer services are a common example of defense evasion techniques used in the Web3 world to hide the flow of cryptocurrency transactions. They are also known as tumblers or coin mixers, designed to help users obscure the origins and destinations of their transactions. 9 | 10 | Mixer services work by receiving cryptocurrency from a user, mixing it with other coins in their pool, and returning it to the user in a way that makes it difficult to trace the original transaction. 11 | 12 | **Example** 13 | 14 | One popular mixer service in the Web3 world is Tornado Cash. It provides high anonymity to users who want to protect their transactions. Tornado Cash is an Ethereum-based mixing service that uses smart contracts to break the transaction link between the original and new addresses. The smart contracts hold a pool of ETH, which users can deposit into using their wallets. Once the funds are deposited, the smart contracts mix them with other deposits and return them to the user's new address in the form of a new ETH amount with a different history. Before an attack, Tornado Cash is used by Web3 users who want to hide their cryptocurrency transactions from being tracked or traced by other users or even government authorities. Using Tornado Cash, these users can protect their privacy and hide their financial activities from others. After an attack, hackers or malicious actors can use Tornado Cash to obscure their financial transactions and prevent investigators from tracking their movements. 15 | 16 | Attackers can use Tornado Cash or similar mixing services to mix stolen funds with other coins, making them difficult or impossible to trace. This makes it harder for law enforcement or investigators to identify and recover the stolen funds. However, it should be noted that the use of mixer services is not illegal, and many legitimate users may use them for privacy reasons. Only when the services are used for illegal activities do they become problematic. 17 | 18 | **Mitigation:** 19 | 20 | As of 2022, some nodes have started to block processing transactions of wallets blacklisted by OFAC. Wallets that have interacted with the mixer can be blacklisted, preventing them from using the services in the future. However, currently, it is almost impossible to prevent the use of mixing services as they are open-source software. -------------------------------------------------------------------------------- /oswar/defense_evasion/obfuscation.md: -------------------------------------------------------------------------------- 1 | # 2. Obfuscation 2 | 3 | Category: Money Laundering 4 | Tags: Defense Evasion 5 | 6 | ## What is "Obfuscation"? 7 | 8 | Obfuscation is a technique attackers use to conceal their malicious code or actions. The goal is to make it difficult for defenders to detect and block the attack. The term "obfuscation" comes from the Latin word "obfuscare," which means "to darken" or "to make obscure". 9 | 10 | Attackers can use obfuscation techniques to hide their malicious code or actions, making it difficult for defenders to detect and block the attack. For example, code obfuscation techniques can hide malware or malicious smart contracts code in the smart contracts. However, it is not “foolproof” and can be exposed. 11 | 12 | Usually, obfuscation is meant to make the code or data difficult to understand or decipher, thereby making it harder for someone to identify and remove malicious code or contracts. Code compression, renaming variables and functions, and adding dummy code. However, these techniques can be reverse-engineered, and advanced malware detection tools can still identify malicious code even if it is obfuscated. In summary, while obfuscation can make detecting and removing malicious code or contracts harder, it is not a foolproof technique. As such, it is still important to have strong security measures and practices to protect against malware and other malicious activity on blockchains and contracts. 13 | 14 | ### Examples: 15 | 16 | - The attacker can use code obfuscation techniques to make the malicious code harder to understand and detect. This can involve renaming variables, using different encoding techniques, and inserting extraneous code to make it more difficult for an analyst to identify the malicious code. In general, it is done to make the code harder to interpret. 17 | - Storing malicious code off-chain: The attacker can store the malicious code off-chain and only include a small piece of code in the smart contract that interacts with the off-chain code. This can make it harder to detect malicious code because it is not all contained in the smart contract. 18 | - Using a multi-contract architecture: The attacker can use a multi-contract architecture to hide the malicious code in a separate contract that is not easily accessible or visible to outsiders. This can make it harder to detect the malicious code because it is not all contained in one place. 19 | 20 | ### Mitigation: 21 | 22 | To mitigate obfuscation, defenders can use various techniques, including: 23 | 24 | - Code analysis tools: Defenders can use tools that analyze code and detect obfuscation techniques. These tools can help identify hidden or obfuscated code and enable defenders to remove it. 25 | - Whitelisting: Defenders can use whitelisting to only allow approved programs to run on a system. This can prevent attackers from running obfuscated code on a system. 26 | - Regular updates: Defenders should regularly update their software and systems to ensure that they have the latest security patches. This can help prevent attackers from exploiting vulnerabilities that may be present in older versions of software or systems. -------------------------------------------------------------------------------- /oswar/discovery/api_discovery.md: -------------------------------------------------------------------------------- 1 | # 1. API Discovery 2 | 3 | Tags: Discovery 4 | 5 | ## What is "API Discovery"? 6 | 7 | After gaining initial access to a dApp, an attacker may attempt to discover its underlying infrastructure, such as connected backend services, databases, or APIs. API Discovery is a technique adversaries use to identify and enumerate Application Programming Interfaces (APIs) exposed by blockchain nodes or decentralized applications (dApps). These APIs interact with the blockchain network and perform various tasks, such as submitting transactions, querying data, or monitoring events. Adversaries can use multiple techniques to discover and enumerate these APIs, such as scanning the network, analyzing the source code of smart contracts or dApps, or using specialized tools designed for API discovery. Once vulnerable or misconfigured APIs are identified, adversaries can exploit them to gain unauthorized access to sensitive data or disrupt the network. 8 | 9 | ### Example: 10 | 11 | An example of this is the FTX collapse. External sources have cited that unauthorized access to API keys was one of the reasons for the hack and subsequent collapse. 12 | 13 | ### Mitigation: 14 | 15 | To reduce the risks associated with API discovery, blockchain developers and organizations can take the following measures: 16 | 17 | 1. Implement Access Controls: Ensure that APIs are protected with authentication and access controls, like API keys or OAuth tokens. This will help prevent unauthorized access to sensitive data or functions. 18 | 2. Monitor API Activity: Keep a close eye on API activity, and log all requests and responses to detect suspicious or unauthorized behavior. This will help identify potential attacks and provide forensic evidence in case of a breach. 19 | 3. Regularly Update and Patch: Keep APIs up-to-date, and patch them to address known vulnerabilities and misconfigurations. This will help reduce the attack surface and prevent the exploitation of known weaknesses. 20 | 4. Use Security Tools: Use specialized security tools designed for API discovery and vulnerability scanning, like Nmap, Burp Suite, or ZAP, to identify and fix vulnerabilities in blockchain APIs. These tools can also help validate access controls' effectiveness and identify potential API implementation weaknesses. 21 | 22 | Source: [https://beincrypto.com/ftx-users-lose-millions-to-api-exploit/](https://beincrypto.com/ftx-users-lose-millions-to-api-exploit/) -------------------------------------------------------------------------------- /oswar/discovery/dumpster_diving.md: -------------------------------------------------------------------------------- 1 | # 2. Dumpster Diving 2 | 3 | Category: Acquire Private Key 4 | Tags: Discovery 5 | 6 | ### What is Dumpster Diving? 7 | 8 | Dumpster diving is a technique used in social engineering that involves searching through an organization's trash or recycling for sensitive information. In the context of Web3, dumpster diving can be used to find information such as notes containing private keys, wallet addresses, and other resources that can be used to facilitate an attack. Attackers can use this method to gather information about their target and plan an attack. 9 | 10 | ### Example: 11 | 12 | For instance, a hacker might have accessed a DApp developer's computer. In this situation, they may use other discovery strategies, like dumpster diving, to uncover more information to aid them in their attack. This scenario is part of the discovery phase since the hacker is still seeking to gather more information, even though they have already hacked into the victim's computer. 13 | 14 | ### Mitigation: 15 | 16 | Organizations should dispose of sensitive information appropriately to reduce the risk of dumpster diving. This can include shredding documents that contain sensitive information and destroying hard drives and other storage devices that are no longer needed. It is also essential to educate employees about the risks of dumpster diving and implement security protocols that limit the amount of sensitive information available physically. Finally, organizations should consider using encryption and other security measures to protect sensitive data, even if it is accidentally disposed of. -------------------------------------------------------------------------------- /oswar/execution/51_attack.md: -------------------------------------------------------------------------------- 1 | # 2. 51% attack 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Execution 5 | 6 | ### What is a "51% attack"? 7 | 8 | A "51% attack" is an attack on a blockchain network. It occurs when an attacker gains control of more than 51% of the network's hash rate, which allows them to add new blocks to the chain faster than the rest of the network. This can result in the attacker being able to reverse transactions, double-spend coins, and potentially take control of the network. The attacker can effectively gain control over the network by creating a longer chain that invalidates previous transactions. A 51% attack also decreases the integrity of the blockchain and, therefore, can also be placed within “Impact”. 9 | 10 | Validators or miners in a blockchain network compete to add new blocks to the chain by solving complex cryptographic puzzles. The first validator to solve the puzzle and add the block to the chain is rewarded with cryptocurrency. 11 | 12 | Validators or miners are responsible for verifying and adding new blocks. If an attacker gains control over most of the network's computational power, they can reverse previous transactions and double-spend coins. This can lead to a loss of trust in the network and significant financial damage to users. 13 | 14 | ### Example 15 | 16 | Bitcoin underwent a 51% attack, which resulted in the creation of Bitcoin Cash. The attack occurred due to a disagreement within the early bitcoin community called the Block Wars. 17 | 18 | Mitigation: 19 | 20 | There are several ways to reduce the risk of a 51% attack on a blockchain network: 21 | 22 | 1. Encourage decentralization: The community can make the network more decentralized by encouraging more participants to become validators or miners. This makes it more difficult for a single entity to gain control of the majority of the network's hash rate. 23 | 2. Implement consensus mechanisms: Consensus mechanisms like Proof-of-Stake (PoS) or Delegated Proof-of-Stake (DPoS) can help reduce the risk of a 51% attack. They require validators or miners to have a stake in the network. 24 | 3. Implement network monitoring: Network monitoring is essential to detect and respond to suspicious activity, including potential 51% attacks. 25 | 26 | In summary, the best way to reduce the risk of a 51% attack is to encourage decentralization, implement consensus mechanisms, conduct regular audits and updates, implement network monitoring, promote diversity in mining hardware, and use checkpointing to protect past transactions. By taking a comprehensive approach to security, it is possible to reduce the risk of a 51% attack and preserve the integrity of the network. 27 | 28 | Left out 29 | 30 | --- 31 | 32 | A 51% attack could also fall under the "Command and Control" category, as the attacker would need to establish and maintain control over the compromised blockchain network to carry out the attack. However, the attack primarily falls under the "Resource Development" and "Execution" categories because it primarily involves acquiring the computing resources needed to control the majority of the network's mining power, and then using those resources to manipulate the blockchain's transaction history. 33 | 34 | The attacker would first need to acquire the computing resources needed to control the network's mining power, which may involve purchasing or renting specialized hardware or using social engineering tactics to gain access to a large number of computers. Once the attacker has acquired the necessary computing resources, they would then use those resources to carry out the attack by mining blocks on the blockchain that contain fraudulent transactions, effectively manipulating the transaction history on the blockchain. 35 | 36 | While the attacker may also need to establish some form of command and control infrastructure to maintain control over the compromised network, this aspect of the attack is secondary to the initial resource development and execution phases of the attack. Therefore, a 51% attack would primarily fall under the "Resource Development" and "Execution" categories. -------------------------------------------------------------------------------- /oswar/execution/access_control_issues.md: -------------------------------------------------------------------------------- 1 | # 5.5 Access Control Issues 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is Access control? 7 | 8 | Access control issues refer to a type of security vulnerability that occurs when inadequate controls or restrictions exist on who can access and modify certain resources or data within a system. This vulnerability can occur in various system areas, including user accounts, databases, APIs, and smart contracts. 9 | 10 | Example 11 | 12 | In the context of smart contracts, access control issues can arise when there need to be more restrictions on who can execute certain functions or modify the state of the contract. For example, suppose a smart contract needs proper access controls. In that case, a malicious actor may be able to manipulate the contract's data or execute unauthorized functions, leading to various types of attacks, such as theft of funds or unauthorized data access. 13 | 14 | Access control issues can also arise in decentralized applications (dApps) that rely on smart contracts. In these cases, the issue may be related to the dApp's user interface, which could allow malicious actors to bypass certain access controls or execute unauthorized functions within the smart contract. 15 | 16 | Mitigation 17 | 18 | To prevent access control issues, it is essential to implement proper authentication and authorization mechanisms that limit access to sensitive resources and ensure that only authorized users can execute certain functions or modify certain data. This includes implementing multi-factor authentication, role-based access control, and secure coding practices when developing smart contracts and dApps. 19 | 20 | Similar to “15.1 validator privileges,” - Inadequate access control smart contracts give hackers access through the lack of restrictions in updating the smart contract state. -------------------------------------------------------------------------------- /oswar/execution/bad_randomness.md: -------------------------------------------------------------------------------- 1 | # 5.8 Bad Randomness 2 | 3 | Category: Logic 4 | Tags: Execution 5 | 6 | What is bad randomness? 7 | 8 | In Web3, "bad randomness" refers to the lack of or weakness in random number generation in smart contracts, making them vulnerable to attacks. A smart contract's functionality may depend on generating random numbers, for example, in gambling or other games that rely on chance. 9 | 10 | If a smart contract's random number generation algorithm is not implemented correctly, an attacker can predict or manipulate it. For example, an attacker could identify patterns in generating random numbers and use this information to manipulate the outcome of a game or other transaction in their favor. 11 | 12 | This vulnerability is categorized under the "Execution" phase because it can be exploited during the actual execution of the smart contract. To mitigate this vulnerability, it is important to use secure and unpredictable random number generation methods, such as using multiple sources of randomness or relying on trusted external sources for randomness. 13 | 14 | Example 15 | 16 | In the 2023 Cyvers Web3 security report, the Wintermute hack was analyzed. One alleged reason for the hack reason of Wintermute was due to the profanity vanity address (private key) generator. 17 | 18 | Its design flaw enabled hackers to predict the outcome through enough computing force. This could be an example of “bad randomness” where hackers could return to the generator and re-compute the answer. It wasn't random enough and followed a pattern that could be “decrypted” through enough computing power. 19 | 20 | Mitigation 21 | 22 | Preventing "bad randomness" smart contract vulnerability can be challenging, as generating truly random numbers in a deterministic and transparent blockchain environment is difficult. However, there are several techniques and best practices that developers can follow to mitigate this vulnerability: 23 | 24 | 1. Use External Randomness Sources: Smart contracts can use external randomness sources to generate random numbers, such as the Oraclize service or a trusted decentralized random number generator like Chainlink VRF. These sources provide an additional layer of randomness that is difficult for attackers to predict or manipulate. 25 | 2. Avoid Using Block Information: Block information such as the block timestamp or block hash should not be used to generate random numbers, as miners can manipulate them. An attacker who knows the exact block information can generate a predictable outcome and manipulate the contract to their advantage. 26 | 3. Pseudorandom Number Generation: If external randomness sources are not available or practical, developers can use pseudorandom number generation techniques. Pseudorandom number generation uses a deterministic algorithm to generate a sequence of numbers that appears random but is repeatable. However, it is important to use a high-quality algorithm and a large enough seed to generate a truly unpredictable sequence. 27 | 4. Publicly Verifiable Randomness: Smart contracts should use publicly verifiable randomness techniques that allow anyone to verify the randomness of the generated number. This ensures that the generated number is not biased or manipulated and that the contract operates as intended. 28 | 5. Third-Party Auditing: Smart contracts should be audited by third-party security experts to identify and address any vulnerabilities, including bad randomness. This helps ensure that the contract is secure and operates as intended, and can prevent potential loss of funds due to vulnerabilities. -------------------------------------------------------------------------------- /oswar/execution/block_timestamp_manipulation.md: -------------------------------------------------------------------------------- 1 | # 5.19 Block Timestamp Manipulation 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “Block timestamp manipulation”? 7 | 8 | Block Timestamp Manipulation vulnerability is a type of vulnerability in smart contracts where an attacker can manipulate the timestamp of a block. The timestamp can be used in smart contracts to determine if a certain action can be executed, such as releasing funds after a certain period. If the timestamp can be manipulated, an attacker can trick the smart contract into executing an action prematurely or delaying it indefinitely. 9 | 10 | Example: 11 | 12 | One real-world example of Block Timestamp Manipulation is the batchOverflow attack on the BEC token smart contract. In this attack, the attacker manipulated the block timestamp to cause an integer overflow when calculating the number of tokens to be transferred, transferring excessive tokens to the attacker's account. 13 | 14 | Source: [https://ethereum.stackexchange.com/questions/46808/why-did-the-batchoverflow-hack-in-the-bec-contract-work](https://ethereum.stackexchange.com/questions/46808/why-did-the-batchoverflow-hack-in-the-bec-contract-work) 15 | 16 | Mitigation: 17 | 18 | The mitigation for Block Timestamp Manipulation involves using a secure time source that attackers cannot manipulate. One solution is to use the block's median timestamp instead of its timestamp as a measure of time. Another solution is to use an external time source, such as an oracle, to provide the time for the smart contract. Additionally, developers should perform proper input validation and limit the number of funds transferred in a single transaction. -------------------------------------------------------------------------------- /oswar/execution/check-effect_interaction.md: -------------------------------------------------------------------------------- 1 | # 5.26 Check-Effect- Interaction (CEI) 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “Check Effect Interaction”? 7 | 8 | "Check-Effect-Interaction" (CEI) is a common pattern used in smart contract development to prevent race conditions and ensure that transactions execute as intended. The CEI pattern involves three steps: 9 | 10 | 1. Check: The contract checks whether the transaction is valid or not. 11 | 2. Effect: If the transaction is valid, the contract executes the intended changes to the contract state. 12 | 3. Interaction: The contract interacts with other contracts or external entities, such as sending or receiving funds. 13 | 14 | Example: 15 | 16 | An example of CEI can be seen in a contract that allows users to withdraw funds. The contract would check that the user has sufficient funds to withdraw, then effect the withdrawal by updating the user's balance, and finally interact with the external entity to send the requested funds to the user's account. 17 | 18 | Without CEI, there is a risk of a race condition where two or more transactions attempt to modify the contract state simultaneously, leading to unexpected behavior and potential vulnerabilities. 19 | 20 | Mitigation: 21 | 22 | To prevent issues related to race conditions, it is essential to follow the CEI pattern when designing and implementing smart contracts. Additionally, contracts should be tested thoroughly to ensure they behave as expected and resist any potential vulnerabilities that may arise from race conditions. -------------------------------------------------------------------------------- /oswar/execution/cross-chain_bridge_attacks.md: -------------------------------------------------------------------------------- 1 | # 5.11 Cross-Chain Bridge Attacks. 2 | 3 | Category: Cross Chain 4 | Tags: Execution 5 | 6 | What is a Cross-Chain Bridge attack? 7 | 8 | A cross-chain smart contract attack is an attack that exploits vulnerabilities in smart contracts that interact with multiple blockchains or networks. Cross-chain smart contracts enable users to perform transactions or execute code on different blockchains, allowing for interoperability and functionality. However, this also opens up new attack vectors for hackers to exploit. 9 | 10 | A cross-chain smart contract attack typically involves the exploitation of a vulnerability in one smart contract to gain unauthorized access to another smart contract on a different blockchain or network. 11 | 12 | Example 13 | 14 | A real-world example of a cross-chain attack is the Nomad hack. 15 | 16 | In August, a security flaw was found in the cross-chain bridge Nomad, and almost all of its funds (more than $190 billion) were drained from its platform. It was when Nomad first altered their code that the assault began. The Nomad Bridge incident was not perpetrated by one entity or organization but involved hundreds of 17 | addresses. Many people “jumped on the train,” noticing that Nomad had a vulnerability that could be exploited. Precisely at 9:32 p.. UTC on August 1, 100 Wrapped $BTC ($WBTC) got stolen from the platform, creating the beginnings of 18 | what we now recognize as a significant security exploit. 19 | 20 | The attackers exploited a flaw in the smart contract's initialize method to send 21 | messages that tricked Noad Bridge into sending stored tokens without proper authorization. With this vulnerability, the malicious actors withdrew more money than they had originally deposited. The attackers continued exploiting the bridge 22 | until an estimated $190 billion worth of cryptocurrency was stolen. 23 | 24 | Mitigation 25 | 26 | To prevent cross-chain smart contract attacks, developers should implement best practices such as: 27 | 28 | 1. Auditing smart contracts for vulnerabilities and testing them under various scenarios. 29 | 2. Cross-chain Real-time monitoring. 30 | 3. Implementing secure communication channels between blockchains to prevent unauthorized access. 31 | 4. Using secure key management and encryption techniques to protect private keys and other sensitive information. 32 | 5. Implementing robust access control mechanisms and limiting the exposure of sensitive information. 33 | 6. Monitoring and analyzing blockchain activities and transactions to detect and prevent suspicious activities. 34 | 7. Leveraging third-party security experts to identify and address potential vulnerabilities in cross-chain smart contracts. 35 | 36 | --- 37 | 38 | Left out: 39 | 40 | Another example of a cross-chain smart contract attack is a replay attack, where an attacker intercepts a valid transaction on one blockchain and replays it on another blockchain. This can allow the attacker to execute the same transaction multiple times, resulting in a loss of funds or other unintended consequences. 41 | 42 | Cross-chain smart contract attacks can also involve the manipulation of consensus mechanisms between different blockchains. For example, an attacker could exploit a vulnerability in a smart contract on one blockchain to manipulate the consensus algorithm of another blockchain, resulting in a loss of funds or other unintended consequences. -------------------------------------------------------------------------------- /oswar/execution/crypto-jacking.md: -------------------------------------------------------------------------------- 1 | # 5.28 Crypto-jacking: 2 | 3 | Tags: Execution 4 | 5 | What is crypto-jacking? 6 | 7 | Crypto-jacking is a cyber-attack where malicious actors use a victim's computing resources to mine cryptocurrency without their knowledge or consent. This attack is usually achieved by injecting a script into a website or a software program, which runs in the background without the user's knowledge or consent. The attacker benefits by receiving the mined cryptocurrency, while the victim suffers from the degraded performance of their device and increased energy consumption. 8 | 9 | Example: 10 | 11 | An example of crypto-jacking is the Coinhive script, which was widely used by cybercriminals to mine Monero cryptocurrency by exploiting the computing power of users who visited compromised websites. Another example is the XMRig malware, which infects computers and mobile devices to mine Monero. 12 | 13 | Mitigation: 14 | 15 | To prevent crypto-jacking, users can take the following measures: 16 | 17 | 1. Install ad-blocking and anti-malware software: These tools can detect and block crypto-jacking scripts before they can infect your device. 18 | 2. Use a browser extension: Some browser extensions, like NoCoin can prevent crypto-jacking scripts from running on your device. 19 | 3. Keep your software up-to-date: Cryptojackers often exploit vulnerabilities in outdated software. Regularly updating your software can help prevent these attacks. 20 | 4. Be cautious of suspicious links and downloads: Crypto-jacking malware can be hidden in phishing emails, malicious websites, and software downloads. Be wary of any suspicious links or downloads, and only download software from trusted sources. 21 | 5. Monitor your device's performance: If it is running slower than usual or consuming more energy, it may be a sign of crypto-jacking. Monitor your device's performance and investigate any suspicious activity. -------------------------------------------------------------------------------- /oswar/execution/default_visibility.md: -------------------------------------------------------------------------------- 1 | # 5.15 Default Visibility 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is Default visibility? 7 | 8 | Default visibilities vulnerability in Web3 refers to an exposure caused by the lack of access modifiers in Solidity contracts, which can lead to unexpected behavior and potentially malicious actions. 9 | 10 | By default, Solidity contract functions have a public visibility level, meaning anyone can call them. This can lead to unintentional actions, such as transferring funds or modifying data, by anyone interacting with the contract. 11 | 12 | For example, if a contract has a function that transfers funds to a specified address and it is set to public visibility, anyone can call this function and transfer funds to any address they choose. This can result in losing funds for the contract owner or users. 13 | 14 | Example 15 | 16 | The first Parity multi-sig hack 17 | 18 | In the first Parity multi-sig hack, about $31M worth of Ether was stolen from primarily three wallets. A good recap of exactly how this was done is given by Haseeb Qureshi in [this post](https://medium.freecodecamp.org/a-hacker-stole-31m-of-ether-how-it-happened-and-what-it-means-for-ethereum-9e5dc29e33ce). 19 | 20 | Mitigation 21 | 22 | To mitigate this vulnerability, it is recommended to use access modifiers such as private, internal, and external to control the visibility and accessibility of functions and variables within a contract. Setting appropriate access levels can greatly reduce the potential for unexpected behavior and malicious actions. 23 | 24 | ```solidity 25 | contract HashForEther { 26 | 27 | function withdrawWinnings() { 28 | // Winner if the last 8 hex characters of the address are 0. 29 | require(uint32(msg.sender) == 0); 30 | _sendWinnings(); 31 | } 32 | 33 | function _sendWinnings() { 34 | msg.sender.transfer(this.balance); 35 | } 36 | } 37 | ``` -------------------------------------------------------------------------------- /oswar/execution/delegate_call.md: -------------------------------------------------------------------------------- 1 | # 5.14 Delegate call 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is a “Delegate call” vulnerability? 7 | 8 | The delegate call vulnerability is a vulnerability in smart contracts on the Ethereum blockchain that allows attackers to call a function in another contract with all of the calling contract's context, including the contract's storage, balance, and code. This vulnerability can allow attackers to take control of a contract or steal funds from it by exploiting the trust relationship between contracts. 9 | 10 | The vulnerability arises because of the delegatecall() function, which can be used to call a function in another contract and is commonly used to implement libraries in Solidity. However, if the input data is not properly validated, an attacker can execute malicious code and take control of the calling contract. 11 | 12 | Examples: 13 | 14 | Parity multi-sig (wallet hack) 15 | 16 | The second Parity multi-sig wallet hack is an example of how the context of well-written library code can be exploited if run in its non-intended context. Several good explanations of this hack exist, such as this overview: [Parity MultiSig Hacked. Again](https://medium.com/chain-cloud-company-blog/parity-multisig-hack-again-b46771eaa838) by Anthony Akentiev, this [stack exchange question](https://ethereum.stackexchange.com/questions/30128/explanation-of-parity-library-suicide/30130) and [An In-Depth Look at the Parity Multisig Bug](http://hackingdistributed.com/2017/07/22/deep-dive-parity-bug/). 17 | 18 | Mitigation 19 | 20 | *“Solidity provides the `library` keyword for implementing library contracts (see the [Solidity Docs](http://solidity.readthedocs.io/en/latest/contracts.html?highlight=library#libraries) for further details). This ensures the library contract is stateless and non-self-destructable. Forcing libraries to be stateless mitigates the complexities of storage context demonstrated in this section. Stateless libraries also prevent attacks whereby attackers modify the state of the library directly to affect the contracts that depend on the library's code. As a general rule of thumb, when using `DELEGATECALL` pay careful attention to the possible calling context of both the library contract and the calling contract, and whenever possible, build state-less libraries.”* 21 | 22 | - [https://blog.sigmaprime.io/solidity-security.html#dc-example](https://blog.sigmaprime.io/solidity-security.html#dc-example) -------------------------------------------------------------------------------- /oswar/execution/denial_of_service_(dos).md: -------------------------------------------------------------------------------- 1 | # 5.12 Denial of Service (DoS) 2 | 3 | Tags: Execution 4 | 5 | What is Denial of Service attacks? 6 | 7 | A denial of Service (DoS) attack is a type of cyber attack that aims to disrupt the normal functioning of a website or network by overwhelming it with a flood of traffic or requests, rendering it inaccessible to legitimate users. In the context of web3, DoS attacks can take several forms, including DoS with (Unexpected) revert and DoS with Block Gas Limit. 8 | 9 | DoS with (Unexpected) revert occurs when an attacker intentionally triggers a function to fail with a revert message, which causes the transaction to consume all the gas allocated to it without achieving its intended purpose. As a result, the remaining transactions in the block fail to execute, leading to a denial of service. This attack can also be launched by exploiting vulnerabilities in the contract code, which allows the attacker to consume all the gas in the block without providing any value to the network. 10 | 11 | DoS with Block Gas Limit is a type of DoS attack where an attacker exploits the block gas limit to consume more resources than required, thereby preventing other transactions from being processed. The attacker can achieve this by either submitting transactions with high gas prices or creating many transactions that consume more gas than the block limit. 12 | 13 | Distributed Denial of Service (DDoS) is another DoS attack involving the attacker controlling multiple devices to launch an attack on the target node. 14 | 15 | The attacker observes the target node and channels the multiple devices under his control to send a large amount of information, flooding the target node. This makes the target crash and unable to fulfill the specified task. 16 | 17 | Example: 18 | 19 | Ethereum experienced a DDoS attack, where transactions were “spamming” the network. *“Ethereum developers are hard at work on a patch, and the attack already costs the hacker about [$4.50 per minute](https://www.reddit.com/r/ethtrader/comments/53xt58/daily_discussion_22sep2016/d7xk6qf). The attack was successful insofar as it slowed down transactions and made the price of ether drop, but other than that, the network is proving resilient.”* 20 | 21 | Source: [https://www.inverse.com/article/21310-ethereum-ddos-cryptocurrency-hackers](https://www.inverse.com/article/21310-ethereum-ddos-cryptocurrency-hackers) 22 | 23 | Mitigation: 24 | There are several ways to mitigate DoS attacks in web3. First of all, it depends on what is being attacked. It can be a blockchain network in itself, like the example. It can also be a simple website experiencing a DoS attack due to bots spamming the website and causing a server overload. This is usually prevented with Captcha-like limitations. 25 | 26 | Developers can implement rate-limiting techniques, such as limiting the number of requests per second, to prevent attackers from flooding any network with requests. Network-level solutions, such as load balancers and firewalls, can also be implemented to filter out malicious traffic and prevent DoS attacks. 27 | 28 | It is also essential to monitor traffic to spot irregularities. -------------------------------------------------------------------------------- /oswar/execution/dependency_risks.md: -------------------------------------------------------------------------------- 1 | # 5.10 Dependency Risks 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What are “Dependency Risks”? 7 | 8 | In the context of smart contracts, dependency risk refers to the potential vulnerabilities that can be introduced into the smart contract code due to external dependencies such as libraries or APIs. 9 | 10 | Smart contracts often rely on external dependencies to perform certain functions or access external resources such as external data feeds or other smart contracts. However, if these external dependencies are not properly secured or validated, they can introduce vulnerabilities in the smart contract code. For example, an attacker could exploit a vulnerability in an external library used by a smart contract to gain unauthorized access to the smart contract's funds or execute malicious code. 11 | 12 | Examples 13 | 14 | 1. Malicious Dependencies: This refers to using a malicious dependency by a smart contract. It can happen when a developer unknowingly uses a third-party library that contains malicious code, which can then be used to exploit the smart contract. 15 | 2. Versioning Issues: Versioning issues arise when a smart contract relies on a specific dependency version, which becomes deprecated or is no longer supported. If the developer doesn't update the dependency, it can lead to potential security vulnerabilities. 16 | 3. Conflicting Dependencies: Sometimes, different dependencies can have conflicting versions of the same library, which can cause issues in the smart contract. If the smart contract relies on these dependencies, it can lead to unexpected behavior or security vulnerabilities. 17 | 4. Package Management Issues: Smart contracts can have package management issues if they use a package manager that is not secure or is susceptible to attacks. Attackers can then inject malicious code into the package manager, which can then be used to exploit the smart contract. 18 | 5. Abandoned Dependencies: Sometimes, dependencies can become abandoned by the developer, meaning they are no longer maintained or updated. If the smart contract relies on these dependencies, it can lead to potential security vulnerabilities, as any issues or bugs in the dependency will not be addressed. 19 | 20 | **Mitigation:** 21 | 22 | To mitigate dependency risk, smart contract developers should carefully vet and validate any external dependencies used in their code. They should also consider using secure coding practices such as input validation and defensive programming techniques to prevent potential attacks. Additionally, developers should regularly monitor and update their dependencies to promptly address any vulnerabilities or security issues. -------------------------------------------------------------------------------- /oswar/execution/entropy_illusion_predictability.md: -------------------------------------------------------------------------------- 1 | # 5.16 Entropy illusion/predictability 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “Entropu Illusion”? 7 | 8 | The Entropy Illusion vulnerability occurs when a blockchain application generates random numbers with insufficient entropy, which can lead to predictable or easily guessable numbers. This can compromise the security of cryptographic operations, such as private key generation or cryptographic signatures, which rely on unpredictable random numbers for their strength. 9 | 10 | All transactions on the Ethereum blockchain are deterministic state transition operations. Meaning that every transaction modifies the global state of the Ethereum ecosystem, and it does so in a calculable way with no uncertainty. This ultimately means no source of entropy or randomness inside the blockchain ecosystem. 11 | 12 | Example: 13 | 14 | A real-world example of the Entropy Illusion vulnerability is the case of the Android Bitcoin Wallet, which was found to use a predictable source of entropy for generating Bitcoin addresses. This made it possible for attackers to predict the addresses generated by the wallet and steal the bitcoins associated with those addresses. 15 | 16 | Source: [https://arstechnica.com/information-technology/2015/05/crypto-flaws-in-blockchain-android-app-sent-bitcoins-to-the-wrong-address/](https://arstechnica.com/information-technology/2015/05/crypto-flaws-in-blockchain-android-app-sent-bitcoins-to-the-wrong-address/) 17 | 18 | Mitigation 19 | 20 | To mitigate the Entropy Illusion vulnerability, developers should ensure that their blockchain applications use enough random number generators or trusted external sources of randomness. Additionally, developers should use well-established cryptographic libraries to generate secure random numbers. It is also recommended to periodically review the source code of blockchain applications to identify potential vulnerabilities and to apply security patches promptly. -------------------------------------------------------------------------------- /oswar/execution/external_contract_referencing.md: -------------------------------------------------------------------------------- 1 | # 5.17 External contract referencing 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “External contract referencing”? 7 | 8 | External Contract Referencing (ECR) is a vulnerability that arises when a smart contract relies on an external contract whose address can be changed by an attacker. This can occur when a smart contract references another contract to perform a specific function. Still, the address of the external contract is not fixed or hard coded in the smart contract. An attacker can exploit this vulnerability by changing the address of the external contract, causing the smart contract to interact with a malicious contract and potentially leading to unauthorized access or data theft. 9 | 10 | Example: 11 | 12 | An example of ECR vulnerability is the King of the Ether smart contract game developed in 2016. The game was designed to be played by depositing Ether into a smart contract, with the winner being the player who deposits the most Ether within a specific time frame. However, the smart contract relied on an external contract for some of its functionality, and the address of this external contract was not hard coded. This allowed an attacker to exploit the vulnerability by deploying a malicious contract with the same name as the external contract and changing its address. The attacker then called the functions in the malicious contract instead of the intended external contract, allowing them to steal the deposited Ether and win the game. 13 | 14 | Source: [https://hackernoon.com/smart-contract-attacks-part-2-ponzi-games-gone-wrong-d5a8b1a98dd8](https://hackernoon.com/smart-contract-attacks-part-2-ponzi-games-gone-wrong-d5a8b1a98dd8) 15 | 16 | Mitigation: 17 | 18 | To mitigate the ECR vulnerability, developers should ensure that the addresses of all external contracts that a smart contract relies on are hardcoded within the smart contract. This makes it more difficult for an attacker to change the address of the external contract and exploit the vulnerability. Additionally, developers should perform extensive testing and auditing to identify and address potential vulnerabilities in their smart contracts. -------------------------------------------------------------------------------- /oswar/execution/floating_pragma.md: -------------------------------------------------------------------------------- 1 | # 5.24 Floating Pragma 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “floating pragma”? 7 | 8 | The "floating pragma" is a vulnerability in smart contracts written in the Solidity programming language. Using a floating pragma statement can result in unexpected behavior due to changes in the compiler version. 9 | 10 | In Solidity, a pragma statement is used to specify the compiler version that should be used to compile the contract. A floating pragma statement is a pragma statement that uses a caret (^) symbol to allow for automatic updates to the compiler version. For example, the statement "^0.8.0" would allow automatic updates to any version greater than or equal to 0.8.0, but less than 0.9.0. 11 | 12 | An example of a floating pragma vulnerability is if a contract uses a floating pragma statement that allows for updates to any version greater than or equal to 0.8.0. If a new compiler version is released that introduces breaking changes to the Solidity language, the contract may be compiled with the new version, resulting in unexpected behavior or even vulnerabilities. 13 | 14 | Example 15 | 16 | - Unknown 17 | 18 | Prevention 19 | 20 | To prevent the floating pragma vulnerability, it is recommended to use a fixed pragma statement that specifies a specific compiler version that is known to work with the contract. This can be done by using a pragma statement such as "pragma solidity 0.8.0;" instead of a floating pragma statement. Additionally, contracts should be tested and audited regularly to ensure they remain secure and functional as changes are made to the Solidity language and compiler. 21 | 22 | If you leave a floating pragma in your code (*pragma solidity ≥ 0.7.0 < 0.9.0.*), you will not be sure which version has been used to compile your code which means that you might encounter unexpected behaviors. 23 | 24 | You should lock the solidity pragma to a specific solidity version so you can be sure of how the contract will behave once deployed. 25 | 26 | Source: [https://medium.com/coinmonks/smart-contracts-common-vulnerabilities-solidity-e64c5506b7f4](https://medium.com/coinmonks/smart-contracts-common-vulnerabilities-solidity-e64c5506b7f4) -------------------------------------------------------------------------------- /oswar/execution/force_feeding.md: -------------------------------------------------------------------------------- 1 | # Force-feeding Attacks 2 | 3 | Category: Smart Contract Vulnerabilities Tags: Execution 4 | 5 | ## What are Force-feeding Attacks? 6 | Smart contracts can be forced to recieve ETH without executing any code blocks. Developers cannot prevent contracts from accepting ETH. 7 | Function logic that is dependent upon an address' balance is now subject to being manipulated by a force-feeding attack. 8 | 9 | ## Example 10 | ``` 11 | contract Attacker { 12 | function receive_ETH(address victim) payable { 13 | selfdestruct(victim); 14 | } 15 | } 16 | ``` 17 | 18 | ## Mitigations 19 | - Implement checks to handle use-case for logic functionality relying on balances 20 | - Stir away from relying on address or EOA balance in SC(smart contact) logic 21 | - Don't assume a SC can block ETH being sent to it. SCs can send value, no value, and data. 22 | 23 | Sources: 24 | - [9 smart contract vulnerabilities and how to mitigate them](https://www.techtarget.com/searchsecurity/tip/Smart-contract-vulnerabilities-and-how-to-mitigate-them) 25 | - [Attack Playbook by Rektify AI](https://github.com/RektifyAI/attack-playbook) 26 | -------------------------------------------------------------------------------- /oswar/execution/logic_bombs.md: -------------------------------------------------------------------------------- 1 | # 5.4 Logic Bombs 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is "Logic Bombs" in Web3? 7 | 8 | Deployment of malicious smart contract contract 9 | 10 | Logic bombs" refer to malicious code (smart contracts) or programs intentionally inserted into software or system by a hacker to execute a harmful action when a specific trigger condition is met. 11 | 12 | In the context of Web3, a logic bomb can be a type of smart contract vulnerability where a certain piece of code is designed to execute an attack or steal funds when a particular condition is met, such as when a specific date or time is reached, or when a particular transaction occurs. For example, a malicious actor could create a smart contract with a logic bomb triggered when a specific user or address interacts with the contract, allowing the attacker to steal funds from that user. 13 | 14 | Example 15 | 16 | Logic bombs" can be deployed in various ways, including through a hacker's own created smart contract. It involves inserting malicious code into a program or smart contract that will execute when certain conditions are met, such as a specific date, time, or event. The code can then carry out malicious actions, such as stealing funds or causing the smart contract to behave unexpectedly. 17 | 18 | A malicious smart contract that interacts with a dApp smart contract can be labeled as a logic bomb if designed to carry out a destructive action at a specific time or under specific conditions. 19 | 20 | For example, a malicious smart contract that appears to provide a legitimate service but is designed to trigger a destructive action when a certain condition is met, such as when a specific address interacts with the contract, could be considered a logic bomb. 21 | 22 | Mitigation: 23 | 24 | To mitigate the risk of logic bombs in Web3, it is most important to monitor smart contracts proactively with real-time monitoring. This will enable developers and protocol founders to detect malicious deployments and interactions, thereby giving them a chance to detect to prevent devastating damage. 25 | 26 | Several on-chain & real-time monitoring solutions exist today, like Cyvers, Forta & Lossless. -------------------------------------------------------------------------------- /oswar/execution/mev.md: -------------------------------------------------------------------------------- 1 | # 3. MEV 2 | 3 | Category: User Target 4 | Tags: Execution 5 | 6 | ## What is MEV? 7 | 8 | MEV (Maximal Extractable Value) refers to identifying and taking advantage of opportunities created by the order in which transactions are processed within a block. 9 | 10 | For example, consider a decentralized exchange (DEX) that uses an automated market maker (AMM) algorithm to determine the price of a cryptocurrency. When a trader wants to swap one token for another on this DEX, they send a transaction processed by the AMM and the blockchain. However, several other traders may also attempt to take advantage of the same price movements by submitting transactions simultaneously while carefully monitoring other traders. In this scenario, the order in which the transactions are included in the block is crucial in determining which trader's transaction is executed first and who ultimately profits from the transaction. 11 | 12 | ## Example: 13 | 14 | Imagine a DeFi lending protocol where users can borrow funds by collateralizing their cryptocurrency holdings. If the value of this collateral drops below a certain threshold, the protocol can liquidate the collateral to recover the borrowed funds. A trader observing the blockchain for these liquidation events can submit a transaction that buys up the liquidated assets at a discount before other traders can react and then sell them for a profit. 15 | 16 | In this scenario, the MEV opportunity arises from the order of transactions in the block rather than by manipulating the transaction pool through front-running. 17 | 18 | ## Mitigation: 19 | 20 | MEV (Miner Extractable Value) exploits refer to a type of attack on a blockchain that allows miners to manipulate transaction orders and potentially profit at the expense of other users. Here are some ways to prevent MEV exploits: 21 | 22 | - Use an MEV protection tool: Tools such as Flashbots can help protect against MEV exploits by allowing users to bundle their transactions and communicate directly with miners. This reduces the incentive for miners to engage in MEV exploits. 23 | - Implement transaction fee caps: Users can limit the profit miners make from MEV exploits by setting caps on transaction fees. This can be done by implementing fee market protocols 24 | - Use privacy-preserving technologies: MEV exploits often rely on the ability to track transactions and manipulate their order. By implementing privacy-preserving technologies such as zk-SNARKs, transactions can be made more private and less susceptible to manipulation. 25 | - Implement transaction finality: MEV exploits often rely on the ability to manipulate transaction order. By implementing transaction finality, transactions become irreversible and less susceptible to manipulation. 26 | - Use decentralized exchanges: Decentralized exchanges (DEXs) can help prevent MEV exploits by eliminating the need for transaction ordering. By using a DEX, transactions are settled in a trustless manner, reducing the risk of MEV exploits. 27 | 28 | It is important to note that preventing MEV exploits is an ongoing challenge in the blockchain space, and new solutions may emerge over time. Users need to stay informed and vigilant against potential threats to their transactions. 29 | 30 | Sources: [https://flashbots.net/](https://flashbots.net/) 31 | 32 | [https://flashbots.net/](https://flashbots.net/) 33 | 34 | [https://www.coindesk.com/what-is-mev-crypto](https://www.coindesk.com/what-is-mev-crypto) 35 | 36 | [https://www.coindesk.com/what-is-mev-crypto](https://www.coindesk.com/what-is-mev-crypto) 37 | 38 | [https://www.coindesk.com/what-is-mev-crypto](https://www.coindesk.com/what-is-mev-crypto) -------------------------------------------------------------------------------- /oswar/execution/mirroring_attack.md: -------------------------------------------------------------------------------- 1 | # Mirroring Attack 2 | 3 | Category: Oracle / AMM 4 | Tags: Execution 5 | 6 | ## What is Mirroring Attack? 7 | This attack simply put, is a collusion between data feeders. A mirroring attack occurs when a node reads from a centralized data source and then duplicates its content across participants who mirror that data. As the number of mirroring participants grows, this increased weight on a single data point can significantly deteriorate error correction mechanisms. 8 | 9 | ## Mitigations 10 | Following are some options to mitigate the Mirroring Attacks: 11 | - Leverage a censorship-resistant oracle that is decentralized by nature, making data public and visible 12 | - Decentralized oracles: Chainlink, Tellor, Witnet, and Redstone Finance 13 | - Utilization of multiple different oracles 14 | - Don’t rely on commit-reveal schemes 15 | - Ensure the confidentiality of data sent by the data feeders 16 | 17 | Mirroring attacks are very hard to detect but don’t fret. The best practice a protocol can implement is using various different oracles in case one fails. It’s worth the gwei in some cases. 18 | 19 | ## Reference 20 | - [RedStone Finance](https://docs.redstone.finance/docs/introduction) 21 | - [Chainlink](https://chain.link) 22 | - [Tellor](https://tellor.io) 23 | - [Witnet](https://witnet.io) 24 | - [Consensys: Oracle Manipulation](https://consensys.github.io/smart-contract-best-practices/attacks/oracle-manipulation/) 25 | - [SoK: Oracles from the Ground Truth to Market Manipulation](https://arxiv.org/pdf/2106.00667.pdf) 26 | -------------------------------------------------------------------------------- /oswar/execution/oracle_attack.md: -------------------------------------------------------------------------------- 1 | # 4. Oracle attack 2 | 3 | Category: Oracle / AMM 4 | Tags: Execution 5 | 6 | ## What is an Oracle Attack? 7 | 8 | An Oracle is a trustworthy third-party data source that a smart contract can use to obtain external information. Oracle attacks involve manipulating the Oracle to provide false or malicious data to the smart contract or any party depending on the data. This can result in unauthorized access, theft of cryptocurrency, or even liquidation events. 9 | 10 | One type of Oracle attack is incorrect or insecure validation, where malicious actors can manually change the price of an Oracle by exploiting vulnerabilities in the validation process. This allows them to provide inaccurate data to the smart contract, which can cause financial losses or unauthorized access. 11 | 12 | ### Example 13 | 14 | A similar hack occurred with BonqDAO. According to reports, the hacker gained access to the Tellor price feed for (wrapped) WALBT collateral by staking 10 TRB tokens, which were valued at approximately $175. [source](https://rekt.news/bonq-rekt/) 15 | 16 | Another instance is the compound oracle liquidation event, in which Coinbase's DAI stablecoin oracles were susceptible to spoofing and oracle manipulation. [source](https://news.bitcoin.com/100-million-liquidated-on-defi-protocol-compound-following-oracle-exploit/) 17 | 18 | Oracle attacks can vary between decentralized and centralized exchanges. Oracles are frequently centralized entities, making them a single point of failure. In such cases, an Oracle attack can result in market data manipulation, leading to market distortions and financial losses. One example is spoofing, which involves executing false orders to manipulate prices and the perception of price action. 19 | 20 | In decentralized exchanges, the most common types of "Oracles" are Automated Market Makers (AMMs) and Order Books. With the AMM model, attackers can manipulate the price of tokens by exploiting liquidity imbalances using flash loans. This can lead to significant market distortions, causing financial losses for traders. On the other hand, with the Order Book model, attackers can manipulate the order books to falsely represent supply and demand, resulting in significant market distortions and financial losses. Although quite distinct, it has its section in the execution list. 21 | 22 | ### Mitigation 23 | 24 | To prevent oracle attacks, it is best to follow secure coding practices such as using multiple independent oracles and drawing a median of the reported price. It is important to thoroughly verify the data and reported price received from the oracle. 25 | 26 | Choose a trustworthy oracle: The first step in preventing oracle attacks is to choose a reputable oracle. It is essential to research the oracle thoroughly and verify its reputation. 27 | 28 | Use a decentralized oracle network: A decentralized oracle network can add an extra layer of security to your dApp. Decentralized oracle networks ensure data integrity by using multiple oracles to verify the same data. Chainlink oracles are an excellent example of this. -------------------------------------------------------------------------------- /oswar/execution/outdated_compiler.md: -------------------------------------------------------------------------------- 1 | # 5.23 Outdated Compiler 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is an outdated compiler? 7 | 8 | An outdated compiler in the database for Web3 refers to an older version of the Solidity programming language compiler, which is used to write smart contracts on the Ethereum blockchain. Solidity is a programming language that enables the development of smart contracts on the Ethereum blockchain. The compiler is responsible for translating Solidity code into bytecode that can be executed on the Ethereum Virtual Machine (EVM). 9 | 10 | As with any software, newer versions of the Solidity compiler are regularly released to fix bugs, improve performance, and introduce new features. An outdated compiler may have security vulnerabilities that attackers could exploit, leading to potential loss of funds or other unintended consequences. 11 | 12 | Example 13 | 14 | The issue with an outdated compiler would be that it does not include security fixes for known vulnerabilities or may need certain security features added in more recent versions. This could make smart contracts written with an outdated compiler more susceptible to attacks. 15 | 16 | - No real-world example was found. 17 | 18 | Mitigation 19 | 20 | The mitigation for an outdated compiler is to update to a recent version of the Solidity compiler. This can be done by downloading the latest compiler version from the official Solidity website or using a package manager like npm or yarn. It is recommended to regularly update the Solidity compiler to ensure the security and reliability of smart contracts running on the Ethereum blockchain. -------------------------------------------------------------------------------- /oswar/execution/self-destruct.md: -------------------------------------------------------------------------------- 1 | # 5.25 Self-destruct 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is the “self-destruct” function? 7 | 8 | The "self-destruct" function in Solidity is a feature that allows a smart contract to be destroyed and its funds to be sent to a designated address. While this can be useful for cleaning up unused contracts and returning funds to investors, it can also be a potential vulnerability if not used properly. 9 | 10 | Example: 11 | 12 | One example of a vulnerability that can arise from the self-destruct function is when a contract's address is publicly available, and an attacker can call the self-destruct function on the contract, causing it to be destroyed. Its funds are to be sent to the attacker's address. 13 | 14 | Another example is when a contract's self-destruct function is combined with a vulnerable function, such as a function that allows an attacker to set the self-destruct address. In this case, the attacker can set the self-destruct address to their own address and then call the vulnerable function, causing the contract to be destroyed and its funds to be sent to the attacker. 15 | 16 | Mitigation: 17 | 18 | To prevent self-destruct vulnerability, it is important to carefully consider the usage of the self-destruct function in a contract and to use it only when necessary. If the self-destruct function is used, it should only be called by an authorized user or function. The designated address should be carefully chosen to ensure funds are sent to the intended recipient. Additionally, contracts should be tested and audited regularly to ensure they remain secure as changes are made to the code. -------------------------------------------------------------------------------- /oswar/execution/semantic_errors.md: -------------------------------------------------------------------------------- 1 | # Semantic Errors in Smart Contracts 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | ## Overview 7 | 8 | Semantic errors represent a unique category of vulnerabilities in smart contracts, often eluding detection by both static and dynamic analysis tools. These errors occur at the level of the contract's logic and require a deep understanding of the intended behavior of each function and variable. Understanding semantic errors is crucial for developing secure and reliable smart contracts. 9 | 10 | ## Description 11 | 12 | Semantic errors are subtle flaws that usually occur due to misunderstandings or misconceptions about the underlying business logic of a smart contract. Unlike syntactic errors, which can be caught by compilers, or more straightforward security vulnerabilities, which may be flagged by automated analysis tools, semantic errors require careful human review. 13 | 14 | ### Characteristics: 15 | 16 | - Not easily detected by static or dynamic analyzers. 17 | - Require understanding of the semantic meaning behind every function and variable. 18 | - May violate the invariants of the smart contract. 19 | 20 | ## Notable Examples 21 | 22 | ### The Redacted Cartel Exploit 23 | 24 | Consider the following example of an ERC20 token smart contract: 25 | 26 | ```solidity 27 | contract ERC20 { 28 | mapping (address => mapping(address => uint256)) internal _allowances; 29 | 30 | function _approve(address owner, address spender, uint256 amount) internal { 31 | _allowances[owner][spender] = amount; 32 | } 33 | 34 | function transferFrom(address from, address to, uint256 amount) external { 35 | require(_allowances[from][msg.sender] >= amount); 36 | 37 | // Incorrect usage of _approve function 38 | _approve(from, to, _allowances[from][to] - amount); 39 | 40 | _transfer(from, to, amount); 41 | } 42 | } 43 | 44 | Issue in the Code: 45 | The issue lies in the line: 46 | 47 | ```solidity 48 | _approve(from, to, _allowances[from][to] - amount); 49 | 50 | This should instead be: 51 | 52 | ```solidity 53 | _approve(from, msg.sender, _allowances[from][msg.sender] - amount); 54 | 55 | The semantic error here is that the _approve function is updating the wrong allowance mapping. The allowance should be updated for msg.sender who is the spender, not the to address. 56 | ``` 57 | ## Solutions and Best Practices 58 | 59 | To mitigate and prevent semantic errors, consider the following strategies: 60 | 61 | - Deep Understanding of Variables: Ensure that you fully understand the meaning and role of every variable being modified. This includes how they interact with other variables and functions in the contract. 62 | - Smart Contract Invariants: Identify the invariants within your smart contract. These are conditions that must remain constant throughout the contract's lifecycle. For example, if a user borrows a token, the overall token supply should remain unchanged. 63 | - Peer Review: Code reviews by experts in the domain can often catch these nuanced errors that automated tools can't. 64 | - Formal Verification: Though complex, formal verification can sometimes help in proving that a smart contract meets its specifications. 65 | - Unit Testing: Write extensive unit tests that cover not just the 'happy path' but all possible edge cases. 66 | - Audit: Before deploying any smart contract, especially those handling valuable assets, it is imperative to get the code audited by specialized smart contract auditing firms. 67 | -------------------------------------------------------------------------------- /oswar/execution/short_address_parameter_attack.md: -------------------------------------------------------------------------------- 1 | # 5.18 Short Address/Parameter Attack 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is a Short Address/Parameter attack? 7 | The Short Address/Parameter Attack vulnerability occurs when a contract or function doesn't validate the length of the input data. It allows an attacker to send a transaction with a shortened input, which can lead to unexpected behavior, including transferring funds to an unintended address or bypassing the intended logic of the contract. The attack is possible because Ethereum's virtual machine (EVM) pads the input data to a specific length, but it doesn't check if the input is that length. 8 | 9 | Example: 10 | In 2018, the smart contract of a blockchain-based game called Fomo3D was found to be vulnerable to a Short Address Attack. The contract was designed to allow players to buy keys and compete for a pot of Ether. However, the function that handled the purchase of keys didn't check the length of the input data, which allowed attackers to exploit the contract and drain the pot of Ether. By sending a transaction with a shortened input, the attacker could bypass the intended logic of the contract and transfer the Ether to their address. 11 | 12 | Source: [https://www.apriorit.com/dev-blog/556-fomo3d-vulnerability](https://www.apriorit.com/dev-blog/556-fomo3d-vulnerability) 13 | 14 | Mitigation: 15 | Developers can mitigate the Short Address/Parameter Attack vulnerability by implementing input validation in their smart contracts. They should check the length of the input data and reject any transactions that don't meet the expected length. Additionally, contracts can use a checksum to verify the integrity of the input data. Using standardized interfaces, like ERC-20 and ERC-721, can also help mitigate the risk of this vulnerability, as these interfaces include standardized functions that validate input parameters. Finally, users can protect themselves by checking the address they are sending funds to, as some wallets automatically pad addresses to prevent this attack. -------------------------------------------------------------------------------- /oswar/execution/state_variable_default_visibility_vulnerability.md: -------------------------------------------------------------------------------- 1 | # 5.1 State Variable Default Visibility Vulnerability 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | State Variable Default Visibility Vulnerability is a type of vulnerability in smart contracts that occurs due to the default visibility of state variables. In Solidity, state variables have internal visibility by default, meaning that they can be accessed by other functions within the same contract but not by functions in other contracts. However, if a developer forgets to explicitly specify the visibility of a state variable, it can become publicly visible, which could lead to unintended consequences. 7 | 8 | In Solidity, functions have visibility specifiers that limit how they can be called. A function's visibility specifies whether it can be called only internally, only externally, by users, by other derived contracts, or only internally. The [Solidity Docs](http://solidity.readthedocs.io/en/latest/contracts.html?highlight=library#visibility-and-getters) offer a detailed explanation of the four visibility specifiers. The default visibility setting for a function is "public," allowing external calls by other users. This section will explore various devastating vulnerabilities in smart contracts that may result from improper usage of visibility specifiers. 9 | 10 | Example 11 | 12 | Functions have a public visibility setting by default. The result is that external users will be allowed to invoke functions that do not indicate any visibility. The issue is that developers may overlook visibility specifiers on functions that should be private (or only callable within the contract itself). 13 | 14 | Let's look at a simple example: 15 | 16 | ``` 17 | contract HashForEther { 18 | 19 | function withdrawWinnings() { 20 | // Winner if the last 8 hex characters of the address are 0. 21 | require(uint32(msg.sender) == 0); 22 | _sendWinnings(); 23 | } 24 | 25 | function _sendWinnings() { 26 | msg.sender.transfer(this.balance); 27 | } 28 | } 29 | 30 | ``` 31 | 32 | [view raw](https://gist.github.com/vasa-develop/21cc35d8a48d7768ab6acaff28b5a445/raw/82a7cd87b6e9da9dcc4a880f29f9ff86bde172d0/HashForEther.sol)[HashForEther.sol](https://gist.github.com/vasa-develop/21cc35d8a48d7768ab6acaff28b5a445#file-hashforether-sol) hosted with by [GitHub](https://github.com/) 33 | 34 | This simple contract is intended to function as a guess-the-address bounty game. A user must create an Ethereum address with the last 8 hex characters set to 0, in order to win the contract's balance. After they have it, they can use the WithdrawWinnings() function to get their reward. However, nothing has been said about how visible the functions will be. In particular, the function _sendWinnings() is public, allowing any address to use it to steal the payout. 35 | 36 | Mitigation 37 | 38 | Even if a function is intended to be publicly accessible, it is best practice to always declare the visibility of the function in a contract. To promote this practice, Solidity's most recent releases will now display warnings during compilation for functions that do not explicitly set their visibility. -------------------------------------------------------------------------------- /oswar/execution/time_manipulation.md: -------------------------------------------------------------------------------- 1 | # 5.7 Time manipulation 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is Time Manipulation? 7 | 8 | Time manipulation is a smart contract vulnerability that allows attackers to exploit a contract by manipulating the timestamps or block numbers. In a blockchain environment, timestamps and block numbers are crucial components of the consensus algorithm that ensures the integrity and immutability of the blockchain. In a smart contract, timestamps and block numbers determine when certain functions should be executed or funds should be unlocked. 9 | 10 | An attacker can exploit this vulnerability by manipulating the timestamps or block numbers to trick the contract into unlocking funds before they are supposed to be available or accessing a specific function in the contract at a reasonable time. This can be especially dangerous in time-sensitive contracts, such as those that involve auctions or token sales. 11 | 12 | Real-World Example 13 | 14 | An old Ponzi scheme called [GovernMental](http://governmental.github.io/GovernMental/) amassed a considerable quantity of ether. Moreover, it was open to timestamp-based attacks. The last player to join a round (for at least one minute) received payment per the contract terms. A miner who was a player might change the timestamp (to a future time to make it seem like a minute had passed), making it seem like they were the last to join for more than a minute (even though this is not true in reality). 15 | 16 | More detail on this can be found in the [History of Ethereum Security Vulnerabilities Post](https://applicature.com/blog/history-of-ethereum-security-vulnerabilities-hacks-and-their-fixes) 17 |  by Tanya Bahrynovska. 18 | 19 | Mitigation: 20 | 21 | The following are some mitigation strategies that can be used to address the time manipulation vulnerability in smart contracts: 22 | 23 | 1. Use Relative Time: Instead of using absolute timestamps, smart contracts can use relative time to determine when certain functions should be executed or funds should be unlocked. This can prevent attackers from manipulating the timestamps to their advantage. 24 | 2. Block Verification: Smart contracts can verify the current block number and timestamp before executing certain functions or unlocking funds. This can prevent attackers from exploiting the contract using outdated or manipulated block numbers and timestamps. 25 | 3. Third-Party Libraries: Developers can use third-party libraries with secure timestamps and block number verification mechanisms. These libraries can help ensure the integrity and immutability of the blockchain and prevent attackers from exploiting vulnerabilities in smart contracts. 26 | 27 | --- 28 | 29 | Left out: 30 | 31 | "Time Manipulation" is a smart contract vulnerability where an attacker exploits the contract by manipulating the timestamps or block numbers to their advantage. For example, they could use this technique to trick a contract into unlocking funds before they are supposed to be available or to access a specific function in the contract at an opportune time. This can be especially dangerous in time-sensitive contracts, such as those that involve auctions or token sales. Time manipulation is one of the common smart contract vulnerabilities that fall under the "Execution" phase of the MITRE framework. -------------------------------------------------------------------------------- /oswar/execution/token_supply_manipulation.md: -------------------------------------------------------------------------------- 1 | # 5.27 Token supply manipulation 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “token supply manipulation”? 7 | 8 | Token supply manipulation, also known as "minting" or "inflation", is a vulnerability that can occur in smart contracts that allow for the creation of new tokens beyond the initial supply. This vulnerability can arise if the contract owner or an authorized user can mint new tokens without proper oversight or limitations. 9 | 10 | An example of token supply manipulation is if a contract owner can mint new tokens at will, without any restrictions or oversight. This can lead to the dilution of existing token holders' shares and potentially impact the token's value. 11 | 12 | An endless mint attack happens when a malicious party or hacker creates excessive tokens within a protocol, raising the supply to an unhealthy level and eroding the token's value. Attackers frequently complete the operation quickly and leave with tokens valued at millions of dollars. Attackers frequently go on to flood the market with all the newly created tokens, driving the price down. 13 | Smart contracts are susceptible to this kind of attack mostly due to code flaws that let hackers take advantage of bugs and weak code areas. 14 | 15 | Example: 16 | 17 | Cover Protocol. 18 | 19 | Hackers used shield mining contracts in the Cover Protocol attack to obtain unauthorized crypto rewards from the system. The Cover staking pool's token price fell by 97% due to the hacker's successful use of 40 quintillion tokens on the network. In this instance, the attacker used 1inch to liquidate over 11,700 coins and steal tokens valued at almost $5 million. 20 | 21 | ```solidity 22 | function _mint(address account, uint256 amount) internal onlyMinter { 23 | 24 | require(account != address(0), "ERC20: mint to the zero address"); 25 | 26 | _totalSupply = _totalSupply.add(amount); 27 | 28 | _balances[account] = _balances[account].add(amount); 29 | 30 | emit Transfer(address(0), account, amount; 31 | 32 | } 33 | 34 | function _addMinter(address newMinter) external onlyOwner { 35 | 36 | minters[newMinter] = true; //or minters.push(newMinter); 37 | 38 | } 39 | ``` 40 | 41 | A cybersecurity attack that took advantage of a flaw in a Cover Protocol smart contract was known as the Cover Protocol exploited in 2020. Because of the vulnerability, attackers could create COVER tokens indefinitely. A security company rectified the flaw in the Cover Protocol smart contract. 42 | 43 | Source: [https://finance.yahoo.com/news/cover-protocol-attack-perpetrated-white-142436248.html?guccounter=1](https://finance.yahoo.com/news/cover-protocol-attack-perpetrated-white-142436248.html?guccounter=1) 44 | 45 | Mitigation 46 | 47 | To prevent token supply manipulation, it is important to implement proper limitations and oversight mechanisms for the minting function. This can include setting a maximum supply limit, requiring multiple approvals or signatures for minting, or implementing a community-driven governance mechanism to oversee the minting process. 48 | 49 | Additionally, it is important to conduct regular audits and security checks of the contract to ensure no vulnerabilities that could allow unauthorized parties to mint new tokens. Any potential vulnerabilities or weaknesses should be identified and addressed promptly to ensure the security and integrity of the contract and its tokens. -------------------------------------------------------------------------------- /oswar/execution/tx_origin_authentication.md: -------------------------------------------------------------------------------- 1 | # 5.22 Tx.Origin Authentication 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is “Tx. Origin Authentication”? 7 | 8 | Solidity has a global variable, tx. origin, which traverses the entire call stack and returns the account address that originally sent the call (or transaction). Using this variable for authentication in smart contracts leaves the contract vulnerable to a phishing-like attack. 9 | 10 | Contracts that authorize users to use the `tx.origin` variable are typically vulnerable to phishing attacks which can trick users into performing authenticated actions on the vulnerable contract. 11 | 12 | Example: 13 | 14 | Consider the simple contract, 15 | 16 | ```solidity 17 | contract Phishable { 18 | address public owner; 19 | 20 | constructor (address _owner) { 21 | owner = _owner; 22 | } 23 | 24 | function () public payable {} // collect ether 25 | 26 | function withdrawAll(address _recipient) public { 27 | require(tx.origin == owner); 28 | _recipient.transfer(*this*.balance); 29 | } 30 | } 31 | ``` 32 | 33 | This contract authorises the `withdrawAll()` function using `tx.origin`. This contract allows for an attacker to create an attacking contract of the form, 34 | 35 | ```solidity 36 | import "Phishable.sol"; 37 | 38 | contract AttackContract { 39 | 40 | Phishable phishableContract; 41 | address attacker; // The attackers address to receive funds. 42 | 43 | constructor (Phishable _phishableContract, address _attackerAddress) { 44 | phishableContract = _phishableContract; 45 | attacker = _attackerAddress; 46 | } 47 | 48 | function () payable { 49 | phishableContract.withdrawAll(attacker); 50 | } 51 | } 52 | ``` 53 | 54 | To utilize this contract, an attacker would deploy it and then convince the owner of the `Phishable` contract to send this contract some amount of ether. The attacker may disguise this contract as their own private address and social engineer the victim to send some form of transaction to the address. The victim, unless careful, may not notice that there is code at the attacker's address, or the attacker may pass it off as being a multi-signature wallet or some advanced storage wallet (remember, the source code of public contracts is not available by default). 55 | 56 | In any case, if the victim sends a transaction (with enough gas) to the `AttackContract` address, it will invoke the fallback function, which in turn calls the `withdrawAll()` function of the `Phishable` contract, with the parameter `attacker`. This will result in the withdrawing all funds from the `Phishable` contract to the `attacker` address. This is because the address that first initialized the call was the victim (i.e. the `owner` of the `Phishable` contract). Therefore, `tx.origin` will be equal to `owner` and the `require` online [11] of the `Phishable` contract will pass. 57 | 58 | Mitigation 59 | 60 | `tx.origin` should not be used for authorization in smart contracts. This isn't to say that the `tx.origin` variable should never be used. It does have some legitimate use cases in smart contracts. For example, if one wanted to deny external contracts from calling the current contract, they could implement a `require` of the from `require(tx.origin == msg.sender)`. This prevents intermediate contracts from being used to call the current contract, limiting the contract to regular code-less addresses. -------------------------------------------------------------------------------- /oswar/execution/unchecked_return_values.md: -------------------------------------------------------------------------------- 1 | # 5.9 Unchecked Return Values 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What is Unchecked Return Values? 7 | 8 | Unchecked return values are a vulnerability category within the "Exploitation" stage of the attack lifecycle. This vulnerability occurs when a smart contract function call returns a value, but the calling contract fails to verify or use the returned value, leaving it unchecked. 9 | 10 | There are several ways of performing external calls in Solidity. Sending ether to external accounts is commonly performed via the `transfer` method. However, the `send` function can also be used, and for more versatile external calls, the `CALL` opcode can be directly employed in Solidity. 11 | 12 | You can send Ether to other contracts by 13 | 14 | - `transfer` (2300 gas, throws an error) 15 | - `send` (2300 gas, returns bool) 16 | - `call` (forward all gas or set gas, returns bool) 17 | 18 | Here we can see that when we use to send or call to send ether or perform any transactions, it returns a boolean value i.e. true or false. 19 | 20 | The `call` and `send` functions to return a Boolean indicating whether the call succeeded or failed. As a result, if the call return value is not checked, execution will resume even if the called contract throws an exception. If the call fails accidentally or an attacker forces the call to fail, this may cause unexpected behavior in the subsequent program logic. 21 | 22 | ![https://miro.medium.com/v2/resize:fit:1400/1*x2t4bTbgy1TqUPwymfz62A.png](https://miro.medium.com/v2/resize:fit:1400/1*x2t4bTbgy1TqUPwymfz62A.png) 23 | 24 | In the above code, you can see that there is a Transfer function that uses a call method to transfer the amount. In the first case, it doesn’t check for the return value, where there is no error handling if the transfer fails. 25 | 26 | In the second one, there is a check for the call's return value. If the call fails it will revert with a “transfer failed” message. 27 | 28 | Real-World Example: 29 | 30 | When sending ETH from one contract to another, like from the King of the Ether contract to an Ethereum Mist "contract-based wallet" contract, it's possible for the transfer to fail if implemented in the "obvious" way in the Solidity contract language due to insufficient gas. 31 | 32 | This resulted in failed transfers from the Kings of Ether contract to users. Without any checks for the call return value, a failed transaction was recorded as a completed transaction in the contract. 33 | 34 | Source 1: **[KotET - Post-Mortem Investigation During the 'Turbulent Age' (06 Feb 2016 to 08 Feb 2016) of the King of the Ether Throne, a serious issue caused some…** 35 | www.kingoftheether.com](https://www.kingoftheether.com/postmortem.html) 36 | 37 | **Real World example is**: 38 | 39 | - [King of the Ether](https://www.kingoftheether.com/postmortem.html) 40 | - [Etherpot](http://aakilfernandes.github.io/blockhashes-are-only-good-for-256-blocks) 41 | 42 | Source 2: [https://sm4rty.medium.com/unchecked-call-return-value-solidity-security-1-fe794a7cdb6f](https://sm4rty.medium.com/unchecked-call-return-value-solidity-security-1-fe794a7cdb6f) 43 | 44 | Mitigation: 45 | 46 | If send or call is used, Always make sure to handle the possibility that the call will fail, by checking the return value. 47 | 48 | To mitigate this vulnerability, developers should ensure that their smart contracts properly handle and verify all return values. This includes checking for errors and verifying that the expected value was returned before proceeding with further actions. Additionally, developers should use tools such as static analysis and code reviews to identify and address potential unchecked return value vulnerabilities before deploying smart contracts. -------------------------------------------------------------------------------- /oswar/execution/uninitialized_storage_pointers.md: -------------------------------------------------------------------------------- 1 | # 5.21 Uninitialized storage pointers 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Execution 5 | 6 | What are “Uninitialized storage pointers”? 7 | 8 | Uninitialized storage pointers vulnerability occurs when a smart contract uses uninitialized storage pointers that can be modified by a potential attacker, allowing them to write malicious code or steal funds. Storage pointers are variables used with smart contracts to store information on the blockchain. Uninitialized storage pointers occur when a developer fails to assign an initial value to a storage pointer. 9 | 10 | The EVM stores data either as `storage` or as `memory`. Understanding exactly how this is done and the default types for local variables of functions is highly recommended when developing contracts. This is because it can produce vulnerable contracts by inappropriately initializing variables. 11 | 12 | To read more about `storage` and `memory` in the EVM, see the [Solidity Docs: Data Location](http://solidity.readthedocs.io/en/latest/types.html#data-location), [Solidity Docs: Layout of State Variables in Storage](http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage), [Solidity Docs: Layout in Memory](http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-in-memory). 13 | 14 | *This section is based off the excellent [post by Stefan Beyer](https://medium.com/cryptronics/storage-allocation-exploits-in-ethereum-smart-contracts-16c2aa312743). Further reading on this topic can be found in Sefan's inspiration, which is this R[eddit thread](https://www.reddit.com/r/ethdev/comments/7wp363/how_does_this_honeypot_work_it_seems_like_a/).* 15 | 16 | Local variables within functions default to `storage` or `memory` depending on their type. Uninitialized local `storage` variables can point to other unexpected storage variables in the contract, leading to intentional (i.e., the developer intentionally puts them there to attack later) or unintentional vulnerabilities. 17 | 18 | Example: 19 | 20 | A honey pot named OpenAddressLottery ([contract code](https://etherscan.io/address/0x741f1923974464efd0aa70e77800ba5d9ed18902#code)) was deployed that used this uninitialized storage variable query to collect ether from some would-be hackers. The contract is in-depth, so I will leave the discussion to this R[eddit thread](https://www.reddit.com/r/ethdev/comments/7wp363/how_does_this_honeypot_work_it_seems_like_a/), where the attack is clearly explained. 21 | 22 | Another honey pot, CryptoRoulette ([contract code](https://etherscan.io/address/0x8685631276cfcf17a973d92f6dc11645e5158c0c#code)), also uses this trick to collect some ether. If you need help figuring out how the attack works, see [An analysis of a couple of Ethereum honeypot contracts](https://medium.com/@jsanjuas/an-analysis-of-a-couple-ethereum-honeypot-contracts-5c07c95b0a8d) for an overview of this contract and others. 23 | 24 | Mitigation: 25 | 26 | The Solidity compiler raises uninitialized storage variables as warnings. Thus developers should pay careful attention to these warnings when building smart contracts. The current version of mist (0.10) doesn't allow these contracts to be compiled. It is good practice to explicitly use the `memory` or `storage` keywords when dealing with complex types to ensure they behave as expected as of Solidity version `0.5.0`use of `memory` and `storage`are mandatory. 27 | 28 | To mitigate this vulnerability, developers should ensure that all storage pointers are initialized with a default value, such as zero or null, before being used in the smart contract. Developers should also perform thorough testing and auditing of their smart contracts to identify and address potential vulnerabilities before deploying them on the blockchain. Additionally, developers should follow best practices for secure codings, such as using secure development frameworks and the principle of least privilege. 29 | 30 | Source: 31 | 32 | [https://github.com/sigp/solidity-security-blog#storage](https://github.com/sigp/solidity-security-blog#storage) -------------------------------------------------------------------------------- /oswar/exfiltration/atomic_swaps.md: -------------------------------------------------------------------------------- 1 | # 2. Atomic swaps 2 | 3 | Category: Money Laundering 4 | Tags: Exfiltration 5 | 6 | ### What are "Atomic Swaps"? 7 | 8 | Atomic swaps are a type of decentralized technology that enables the exchange of one cryptocurrency for another without the need for a centralized exchange. While this technology can be exploited to obscure the flow of funds and parties involved in a transaction during the money laundering phase of an attack, it can also be used for legitimate purposes. 9 | 10 | In a money laundering attack, a hacker might use atomic swaps to convert stolen cryptocurrency into a more privacy-focused cryptocurrency like Monero or Zcash. Doing so makes it more difficult for investigators to trace the stolen funds back to the original source. 11 | 12 | Atomic swaps utilize smart contracts to create a trustless exchange between two parties. For example, a hacker could set up a smart contract to exchange their stolen Bitcoin for an equivalent amount of Monero without needing a centralized exchange or intermediary. 13 | 14 | ### Example: 15 | 16 | In a money laundering attack, a hacker might exploit atomic swaps to convert stolen cryptocurrency into a more privacy-focused cryptocurrency like Monero or Zcash, making it difficult for investigators to trace the stolen funds back to the original source. 17 | 18 | ### Mitigation: 19 | 20 | To mitigate the risk of atomic swaps being used for money laundering, cryptocurrency exchanges and financial institutions can implement robust anti-money laundering (AML) and know-your-customer (KYC) policies. They can also use blockchain analytics tools to monitor transactions and detect suspicious activity. Additionally, regulators can impose stricter regulations on cryptocurrency exchanges and financial institutions to prevent using atomic swaps for illicit purposes. -------------------------------------------------------------------------------- /oswar/exfiltration/privacy_solutions_like_monero.md: -------------------------------------------------------------------------------- 1 | # 1. Privacy solutions like Monero 2 | 3 | Category: Money Laundering 4 | Tags: Exfiltration 5 | 6 | ### What is Monero? 7 | 8 | One of the features that some blockchains offer is privacy through encryption and cryptography. Monero is a popular example of this. 9 | 10 | Monero is a privacy-focused solution that uses advanced cryptography techniques to obscure transaction details, making it difficult to trace the source and destination of funds. It uses techniques like ring signatures, stealth addresses, and confidential transactions to make transactions untraceable and un-linkable, offering enhanced privacy and anonymity to its users. This makes it an attractive option for those prioritizing privacy in their transactions. In fact, stolen assets are often converted to Monero and sent to other wallets anonymously due to their privacy features. 11 | 12 | Another use case for Monero is in the context of exfiltration. Hackers may use Monero to receive payment for stolen data, as it allows them to conceal their identity and makes it difficult for law enforcement to track the funds. 13 | 14 | ### Example 15 | 16 | Let's say a Web3 application on the Ethereum blockchain has been hacked, and funds have been stolen. To cover their tracks, a hacker might convert the assets to Monero and send them to anonymous wallet addresses. This is what's known as the "money laundering" phase of an attack. 17 | 18 | ### Mitigation 19 | 20 | To mitigate the risk of exfiltration, organizations can implement strong access controls, encryption, and monitoring systems. However, privacy solutions like Monero have not been compromised and are available on exchanges, making it challenging to prevent exfiltration except on a centralized exchange actively. -------------------------------------------------------------------------------- /oswar/gas_vulnerabilities/gas_griefing.md: -------------------------------------------------------------------------------- 1 | # Gas Griefing 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Gas Vulnerabilities 5 | 6 | ## What is GAS Griefing ? 7 | Gas griefing attack happens when a user sends the amount of gas required to execute the target smart contract, but not its sub calls.Gas griefing attacks can occur on Contracts that take in data and utilize it in a sub-call to a different Contract. If this sub-call doesn't succeed, the entire transaction might either be reverted back or execution might continue. 8 | 9 | This can be particularly problematic for a relayer contract. In this case, the individual who carries out the transaction, known as the 'forwarder', can essentially block transactions by allocating just enough gas for the transaction to be executed, but not providing sufficient gas for the sub-call to be successful. 10 | 11 | ## An illustration of the Gas Griefing security vulnerability in technical terms 12 | ```js 13 | pragma solidity ^0.5.0; 14 | 15 | contract Relayer { 16 | 17 | function relay (Target target, bytes memory _data) public returns (bool) 18 | 19 | { 20 | 21 | (bool success,) = address(target).call(abi.encodeWithSignature("execute(bytes)", _data)); 22 | // then send money to the user 23 | 24 | return success; 25 | 26 | } 27 | 28 | } 29 | 30 | contract Target { 31 | 32 | bool public result = false; 33 | 34 | function execute(bytes memory _data) public { 35 | 36 | uint j = 0; 37 | 38 | for(uint i;i<100;i++){ 39 | 40 | j++; 41 | 42 | } 43 | 44 | result = true; 45 | 46 | } 47 | 48 | function setresult(bool v) public{ 49 | 50 | result = v; 51 | 52 | } 53 | 54 | } 55 | ``` 56 | Assume the "Target" contract is the one with which the "Relayer" contract interacts. 57 | 58 | The weakest contract is the relayer contract, and line 7 is where the weakness lies. Look closely at this line to notice the smart contract's attempt to invoke the Target smart contract's execute() function. The method continues to run without any issues because neither the amount of gas left in the tank nor the call's outcome is checked. The application functionality may be severely impacted by this behavior. 59 | 60 | This only indicates that perhaps the smart contract "Target" did not correctly complete its execution (insufficient gas). Try raising the gas cap and running the smart contract method relay() once again to confirm this. You can now see that the value of the result variable has changed. 61 | By adding gas checks before making the calls, you may prevent this behavior from causing vulnerability in the smart contract. 62 | 63 | ## Mitigations 64 | Following are some options to Mitigate the Gas Griefing Issue. 65 | - Only allow trusted users to relay transactions. 66 | - Require that the forwarder provides enough gas. 67 | - Perform gasEstimations before doing the transaction to the subcontract. 68 | 69 | It is to be noted that Gas Griefing are difficult to mitigate since the gasEstimations can get wrong if transaction costs are high on the EVM. 70 | 71 | ## Reference 72 | - https://swcregistry.io/docs/SWC-126 73 | - https://www.getsecureworld.com/blog/smart-contract-gas-griefing-attack-the-hidden-danger/ 74 | - https://www.linkedin.com/pulse/gas-griefing-attack-olympix/?trk=pulse-article_more-articles_related-content-card 75 | -------------------------------------------------------------------------------- /oswar/gas_vulnerabilities/test.md: -------------------------------------------------------------------------------- 1 | Testing files -------------------------------------------------------------------------------- /oswar/impact/data_destruction.md: -------------------------------------------------------------------------------- 1 | # 2. Data Destruction 2 | 3 | Category: Money Laundering 4 | Tags: Impact 5 | 6 | ### What is "data destruction"? 7 | 8 | Data destruction refers to attackers' techniques to destroy, alter, or corrupt critical data stored on a system or network. In the context of Web3, this can include attacks on blockchain data, smart contract code, and other sensitive information used to facilitate transactions and user interactions. By destroying data, attackers can cause significant financial losses, disrupt business operations, and compromise the integrity and trust of the Web3 ecosystem. 9 | 10 | This attack subcategory involves techniques that destroy or corrupt critical data stored on a Web3 network or application. Examples include wiping out transaction logs, altering or deleting smart contract code, or corrupting blockchain data. 11 | 12 | ### Example 13 | 14 | For example, an attacker may exploit a vulnerability in a smart contract to corrupt the code or alter the state of the blockchain, resulting in the loss or theft of funds. Another example is the use of ransomware to encrypt or delete critical data, demanding payment in exchange for the decryption key or restoration of the data. These types of attacks can have severe consequences, as they can result in the permanent loss of data, loss of customer trust, and legal or regulatory repercussions. 15 | 16 | ### Mitigation 17 | 18 | To mitigate the impact of data destruction attacks, developers and users of Web3 systems should implement strong security measures, such as using encryption to protect data at rest and in transit, implementing access controls and permissions to restrict unauthorized access, and regularly backing up critical data. It is important to note that most smart contracts are immutable and cannot be changed. 19 | 20 | Implementing disaster recovery plans and incident response procedures can also help to minimize the impact of data loss or corruption. Additionally, conducting regular security assessments and penetration testing can help to identify and address vulnerabilities before attackers exploit them. -------------------------------------------------------------------------------- /oswar/impact/disrupt_system_operation.md: -------------------------------------------------------------------------------- 1 | # 1. Disrupt System Operation 2 | 3 | Category: Money Laundering 4 | Tags: Impact 5 | 6 | ### What is “Disrupt System Operation? 7 | 8 | Disrupt System Operation refers to a set of techniques used by attackers to interfere with the normal functioning of a system or network. In the context of Web3, this can involve attacks on the blockchain, smart contracts, and decentralized applications that enable transactions and interactions between users. Disrupting system operations can cause service outages, disrupt business operations, or result in unauthorized access to sensitive information or assets. 9 | 10 | This category of attacks encompasses techniques that aim to disrupt the normal operation of a Web3 system or network. 11 | 12 | ### Example 13 | 14 | Examples of these techniques include launching DDoS attacks, manipulating smart contracts to cause unexpected behavior, or exploiting vulnerabilities to crash nodes or clients. 15 | 16 | For instance, an attacker may flood a Web3 network with many requests to render it unable to process legitimate transactions. Another example is the exploitation of vulnerabilities in smart contracts, which can result in unexpected behavior or unauthorized access to funds. These types of attacks can lead to significant financial losses, damage the reputation of a business, and have legal or regulatory repercussions. 17 | 18 | ### Mitigation 19 | 20 | Developers and users of Web3 systems should implement best practices for security to mitigate the impact of Disrupt System Operation attacks. For example, regularly updating software, using multi-factor authentication, and conducting vulnerability assessments and penetration testing can help to ensure security. Additionally, implementing redundancy and backup measures, such as distributed data storage and failover mechanisms, can minimize the impact of system disruptions. Monitoring network traffic and system logs is also essential for detecting and responding to anomalous behavior and potential attacks promptly. -------------------------------------------------------------------------------- /oswar/impact/eclipse_attack.md: -------------------------------------------------------------------------------- 1 | # 5. Eclipse Attack 2 | 3 | Category: User Target 4 | Tags: Impact 5 | 6 | ### What is an eclipse attack? 7 | An eclipse attack is where a malicious actor isolates a node from the rest of the network. 8 | 9 | It works by redirecting the target node's inbound and outbound connections to nodes that the malicious actor controls, resulting in that node not being able to communicate with the legitimate network. 10 | 11 | This can lead to the target node wasting processing power mining blocks that can not be included on the legitimate network. In theory, this could lead to a 51% attack if the malicious actor is able to isolate enough nodes on the network and increase the value of their own processing power. 12 | 13 | The target node could also then be a victim of a double spend attack if misdirected to accept an input that has already been used in a transaction on the legitimate network. 14 | 15 | 16 | ### Example 17 | An N-confirmation double spend attack would involve a malicious actor isolating mining nodes and a merchant node from the legitimate network. The malicious actor can then broadcast a transaction with the merchant to the mining nodes, which would lead to the transaction being approved and added to a blockchain that is only in use between these eclipsed nodes. This compromised network could then mine a number of nodes until the required confirmation number is met, at which point the merchant would release the goods/services. 18 | 19 | ### Mitigation 20 | An individual node could protect itself by blocking incoming connections and whitelisting trusted nodes for outbound connections. However, if all nodes in a network were to take this approach it would prevent the network from accepting new nodes thus the network would be unable to grow. 21 | -------------------------------------------------------------------------------- /oswar/impact/network_shutdown.md: -------------------------------------------------------------------------------- 1 | # 4. Network shutdown 2 | 3 | Category: Money Laundering 4 | Tags: Impact 5 | 6 | ### What is a "Network shutdown"? 7 | 8 | Network shutdown is a type of cyber attack that can significantly affect the availability and integrity of Web3 systems. These attacks typically disrupt communication channels between nodes in a decentralized network, rendering the network unavailable or partially unavailable to legitimate users. Network shutdown attacks can take different forms, such as DDoS attacks, targeted attacks on specific nodes, or attacks on network infrastructure. 9 | 10 | For example, in a decentralized cryptocurrency network like Bitcoin, a network shutdown attack could involve overwhelming the network with a high volume of malicious transactions or targeting key nodes in the network. This could lead to a slowdown or complete halt in the processing of legitimate transactions, resulting in financial losses for users and potentially harming the network's reputation. 11 | 12 | It's important to note that network shutdown is sometimes the reaction of protocol developers to halt an attack. Even if the attack is successful or not, such events highlight the issue of the integrity and availability of the blockchain. 13 | 14 | ### Mitigation 15 | 16 | To reduce the impact of network shutdown attacks on Web3 systems, organizations, and developers can implement various measures. One approach is to deploy multiple nodes in different geographical locations, which can increase the resilience and redundancy of the network. Additionally, developers can design their applications to use alternative communication channels, such as off-chain channels or alternative consensus mechanisms, to reduce the impact of network shutdown attacks. Network monitoring and detection tools can also help organizations identify and respond to network shutdown attacks promptly. Finally, organizations can implement incident response plans and conduct regular security assessments to ensure the ongoing security and resilience of their Web3 systems. -------------------------------------------------------------------------------- /oswar/impact/spartacus_attack.md: -------------------------------------------------------------------------------- 1 | # Spartacus Attack 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Impact 5 | 6 | ## What is Spartacus Attack? 7 | A Spartacus attack is synonymous with “identity hijacking.” A node assumes the identity of another node, intercepting the messages sent to the intended receiver node. The attack node simply copies the intended receiver node ID. 8 | 9 | 10 | 11 | ## Mitigations 12 | Following are some options to mitigate the Sybil Attacks: 13 | - Implementing node IDs as public key hashes and requiring messages to be signed 14 | - Disable the attacker’s ability to generate a corresponding private key owned by the intended receiver node to prevent transactions from being signed 15 | - Node IDs implemented as ECDSA public key hashes 16 | 17 | 18 | ## Reference 19 | - [A Balanced Trust-Based Method to Counter Sybil and Spartacus Attacks in Chord](https://www.hindawi.com/journals/scn/2018/4963932/) 20 | - [Security analysis of blockchain technology](https://www.theseus.fi/bitstream/handle/10024/169305/Security%20analysis%20of%20blockchain%20technology.pdf?sequence=2&isAllowed=y) 21 | - [A Comprehensive Survey on Blockchain-Based Decentralized Storage Networks 22 | ](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=10026822) 23 | -------------------------------------------------------------------------------- /oswar/impact/sybil_attack.md: -------------------------------------------------------------------------------- 1 | # Sybil Attack 2 | 3 | Category: Smart Contract Vulnerabilities 4 | Tags: Impact 5 | 6 | ## What is Sybil Attack? 7 | Sybil attacks occur when large amounts of nodes are created in an attempt to disrupt a P2P(peer-to-peer) network operation by hijacking or dropping messages. The nodes created are pseudonymous identities that gain disproportionately large influence in the network. Sybil attacks typically occur on blockchains that operate on PoS(Proof-of-Stake) consensus mechanism. 8 | 9 | 10 | ## The Tor attack in 2014: 11 | Tor is the earliest evidence of a Sybil attack on a P2P blockchain network. Tor, by design, is a P2P network that enables private messaging. During the attack, the hacker gained controlled about 115 relays from a single IP address. Moreover, similar to a 51% attack, the attacker was able to gain a significant influence over the network. 12 | 13 | 14 | ## Mitigations 15 | Following are some options to mitigate the Sybil Attacks: 16 | - Consider PoW(Proof-of-work) consensus framework (computational power is too large for a Sybil attack to be deployed) 17 | - Implement a storage node reputation system that involves a prolonged initial vetting period that nodes must complete before they are trusted with significant amounts of data or membership 18 | - Determine the similarity between two relay descriptors to discover if those relay descriptors run the same operator. 19 | - Implementation of a relay monitoring system. 20 | 21 | ## Reference 22 | - [Imperva: Sybil Attack](https://www.imperva.com/learn/application-security/sybil-attack/) 23 | - [Protecting the Tor network from Sybil attacks 24 | ](https://petsymposium.org/2015/papers/winter-sybil-hotpets2015.pdf) 25 | - [Sybil Attack in Blockchain: Examples & Prevention](https://hacken.io/insights/sybil-attacks/) 26 | -------------------------------------------------------------------------------- /oswar/initial_access/Proxy_Phishing_NFTs: -------------------------------------------------------------------------------- 1 | # 2. Proxy Phishing NFTs 2 | 3 | Category: User Target 4 | Tags: Initial Access 5 | 6 | ### What is "OpenSea OwnableDelegateProxy Phishing"? 7 | 8 | OpenSea OwnableDelegateProxy phishing is a form of cybersecurity threat, specifically a phishing attack, which targeted users of the OpenSea marketplace. It primarily affected users who had listed Non-Fungible Tokens (NFTs) using the legacy Wyvern Protocol. 9 | 10 | Wyvern Protocol, in combination with WyvernProxyRegistry, created the OwnableDelegateProxy. This Delegate Proxy is a type of Ethereum smart contract that users interact with when they engage in buying or selling NFTs on OpenSea. When a user lists an NFT for sale, they delegate authority to this contract to withdraw their NFTs to facilitate order matching. 11 | 12 | ### Example 13 | 14 | The phishing attack took advantage of this process by deceiving users into signing a transaction that seemingly appeared routine, but in actuality transferred the ownership of their Delegate Proxy contract to the attacker via the **"upgradeTo()"** function. Once the attacker assumed control of the Delegate Proxy, they had the ability to withdraw NFTs directly from the victim's wallet. This exploit was notably prevalent for NFTs listed on OpenSea before May 2022, which is when OpenSea transitioned from the Wyvern Protocol to its newer Seaport Protocol. 15 | However, a minority of users are still using the old contract [WyvernProxyRegistry](https://etherscan.io/address/0xa5409ec958c83c3f309868babaca7c86dcb077c1) to create accounts. 16 | 17 | ### Mitigation 18 | 19 | Users are advised to exercise caution before signing any transactions and to thoroughly verify the details of each transaction. Additionally, it is recommended to revoke permissions to the old OpenSea contract via platforms such as Revoke.cash, to limit potential exposure to this form of attack. 20 | 21 | ### Reference 22 | - [2 BYAC hacked by signing a malicious Opensea OwnableDelegateProxy upgrade transaction](https://twitter.com/realScamSniffer/status/1666258509221216257) 23 | -------------------------------------------------------------------------------- /oswar/initial_access/Proxy_Phishing_NFTs.md: -------------------------------------------------------------------------------- 1 | # 2. Proxy Phishing NFTs 2 | 3 | Category: User Target 4 | Tags: Initial Access 5 | 6 | ### What is "OpenSea OwnableDelegateProxy Phishing"? 7 | 8 | OpenSea OwnableDelegateProxy phishing is a form of cybersecurity threat, specifically a phishing attack, which targeted users of the OpenSea marketplace. It primarily affected users who had listed Non-Fungible Tokens (NFTs) using the legacy Wyvern Protocol. 9 | 10 | Wyvern Protocol, in combination with WyvernProxyRegistry, created the OwnableDelegateProxy. This Delegate Proxy is a type of Ethereum smart contract that users interact with when they engage in buying or selling NFTs on OpenSea. When a user lists an NFT for sale, they delegate authority to this contract to withdraw their NFTs to facilitate order matching. 11 | 12 | ### Example 13 | 14 | The phishing attack took advantage of this process by deceiving users into signing a transaction that seemingly appeared routine, but in actuality transferred the ownership of their Delegate Proxy contract to the attacker via the **"upgradeTo()"** function. Once the attacker assumed control of the Delegate Proxy, they had the ability to withdraw NFTs directly from the victim's wallet. This exploit was notably prevalent for NFTs listed on OpenSea before May 2022, which is when OpenSea transitioned from the Wyvern Protocol to its newer Seaport Protocol. 15 | However, a minority of users are still using the old contract [WyvernProxyRegistry](https://etherscan.io/address/0xa5409ec958c83c3f309868babaca7c86dcb077c1) to create accounts. 16 | 17 | ### Mitigation 18 | 19 | Users are advised to exercise caution before signing any transactions and to thoroughly verify the details of each transaction. Additionally, it is recommended to revoke permissions to the old OpenSea contract via platforms such as Revoke.cash, to limit potential exposure to this form of attack. 20 | 21 | ### Reference 22 | - [2 BYAC hacked by signing a malicious Opensea OwnableDelegateProxy upgrade transaction](https://twitter.com/realScamSniffer/status/1666258509221216257) 23 | -------------------------------------------------------------------------------- /oswar/initial_access/dns_hijacking.md: -------------------------------------------------------------------------------- 1 | 2 | # 2. DNS Hijacking 3 | 4 | Category: Higher Privilege Attacks 5 | Tags: Initial Access 6 | 7 | ### What is DNS Hijacking? 8 | DNS Hijacking, also known as DNS Redirection, is a form of malicious attack where an attacker alters the DNS (Domain Name System) configuration. The attacker can then redirect the victim to fraudulent websites, often for the purpose of phishing, spreading malware, or stealing sensitive information. DNS is crucial for internet browsing as it translates domain names (like www.example.com) into IP addresses. A DNS hijacking attack can manipulate this process, rerouting a user’s online traffic to potentially harmful destinations. 9 | 10 | ### Example: 11 | A real-world example of a DNS hijacking attack is the Curve Finance incident that occurred on August 10, 2022. The attackers hijacked the DNS and injected a malicious contract address via JavaScript into the front-end of the Curve Finance protocol, a reputable coin-swapping platform in the decentralized finance (DeFi) sector. This allowed the attackers to reroute users’ funds and approvals from Curve.fi into their own wallets, resulting in a loss of around $575,000 from users’ accounts. Unaware users believed they were interacting with the legitimate Curve Finance platform, but they were actually authorizing transactions that drained their funds. 12 | 13 | ### Mitigation: 14 | Some of the best practices To mitigate DNS hijacking attacks 15 | 1. Using secure network protocols like HTTPS and DNSSEC (Domain Name System Security Extensions) which provide authentication of DNS data, data integrity, and authenticated denial of existence. 16 | 2. Using strong, unique passwords to prevent unauthorized access to routers and other network devices. 17 | 3. Enabling two-factor authentication (2FA) for an additional layer of security. 18 | 19 | ### Reference 20 | https://rekt.news/curve-finance-rekt/ 21 | -------------------------------------------------------------------------------- /oswar/initial_access/forged_address_phishing.md: -------------------------------------------------------------------------------- 1 | # 6. Forged address phishing 2 | 3 | Category: User Target 4 | Tags: Initial Access 5 | 6 | ### What is “Forged address phishing”? 7 | 8 | Forged address phishing is a type of scam where an attacker creates a fake address that looks similar to a legitimate one and sends a small amount of cryptocurrency to the target's account from the fake address. This scam is similar to Zero Transfer Phishing, but instead of zero transfers, attackers use actual amounts. The attacker hopes that the target will mistake the fake address for the real one and copy it for a larger transaction, leading to the target mistakenly sending their cryptocurrency to the attacker's address instead of the intended recipient. 9 | 10 | ### Example 11 | 12 | For example, let's say a user wants to transfer $50,000 worth of Ether to their friend's address, 0x123456789abcdef. The attacker monitors this transaction and creates a fake address that looks very similar, such as 0x123456789abcdee, and sends a small amount of Ether, say $0.1, from the fake address to the user's account. The attacker hopes that the user will copy the fake address instead of the real one when making the large transfer, leading to the user mistakenly sending the $50,000 worth of Ether to the attacker's address. 13 | 14 | ### Mitigation 15 | 16 | To avoid falling for this type of phishing scam, users should always double-check the authenticity of the address they are sending funds, especially when dealing with large amounts of cryptocurrency. One way to do this is by comparing the first and last few characters of the address to ensure they match the intended recipient's address. Additionally, users can use secure communication channels, such as encrypted messaging or phone calls, to confirm the legitimacy of the recipient's address before sending any funds. Finally, it is essential to be aware of common cryptocurrency scams and stay vigilant against suspicious activity. 17 | 18 | --- 19 | 20 | After the zero transfer scam, we find a new similar phishing method that is rampant nowadays!! Here is the summary: 21 | 22 | 1. After monitoring, a user initiates a large transfer to a particular address (usually above $10,000), and the scammer will forge an address highly similar to the previous transfer target. 23 | 2. The scammer then sends a nominal amount, usually less than $0.1, to the user's account from this forged fake address. 24 | 3. And if the user mistakenly believed that this small deposit came from the original transfer address and copied it. Oooooooop!!!! They fall for the phishing trap and transfer their money to the scammer. 25 | 26 | This is a new type of phishing, similar to the previous "zero-transfer" scam. Stay vigilant and only readily copy the address of a small deposit after verifying its authenticity. -------------------------------------------------------------------------------- /oswar/initial_access/malicious_code_injection.md: -------------------------------------------------------------------------------- 1 | # 3. Malicious Code Injection 2 | 3 | Tags: Initial Access 4 | 5 | What is Malicious Code Injection? 6 | 7 | Malicious code injection, also known as code injection, is a type of attack where an attacker inserts harmful code into a web application or web browser. The malicious code is designed to perform harmful actions, such as stealing sensitive information, gaining unauthorized access or control of the system, or spreading malware. The injected code can persist and continue to execute, enabling the attacker to maintain control over the system. 8 | 9 | Example: 10 | 11 | One example of a malicious code injection attack is the Cross-Site Scripting (XSS) attack, where an attacker injects malicious code into a vulnerable web application. The malicious code is executed by the victim's browser when they visit the compromised web page, potentially stealing sensitive information or manipulating the user's interaction with the web application. 12 | 13 | Mitigation: 14 | To mitigate malicious code injection attacks, it is important to follow secure development practices for web applications and browsers. Some best practices to follow include: 15 | 16 | 1. Input validation and sanitization: Validating and sanitizing user inputs can help prevent the injection of malicious code into web applications or browsers. Developers should implement strict validation rules and sanitize user inputs to eliminate potential code injection points. 17 | 2. Secure coding practices: Following secure coding practices can help prevent vulnerabilities that can be exploited for code injection attacks. Developers should stay up-to-date on common web application vulnerabilities, such as SQL injection and XSS, and take steps to mitigate them in their code. 18 | 3. Regular security reviews and testing: Conducting thorough security reviews and testing can help identify vulnerabilities in web applications or browsers, including potential code injection points. This can allow for vulnerabilities to be addressed before they can be exploited by attackers. 19 | 4. Implementing Content Security Policy (CSP): A Content Security Policy can help protect against code injection attacks by restricting the sources from which scripts can be loaded and executed. This can help prevent attackers from injecting malicious scripts into web applications. 20 | 5. Monitoring and responding to suspicious activity: Regular monitoring of web applications and browsers can help detect and respond to suspicious activity, such as unexpected changes to web pages or unusual patterns of user behavior. Implementing automated alert systems can help ensure that security incidents are detected and responded to in a timely manner." 21 | 22 | --- -------------------------------------------------------------------------------- /oswar/initial_access/malware.md: -------------------------------------------------------------------------------- 1 | # 5. Malware 2 | 3 | Category: Malware based 4 | Tags: Initial Access 5 | 6 | ### What is Malware? 7 | 8 | Malware, in this case, refers to using malicious software or code to gain unauthorized access to a target organization's systems. Within “Initial Access”, the malware establishes a foothold within a network or targeted computer. 9 | 10 | ### Example 11 | 12 | One example could be keylogging software, which captures a user's private keys or other sensitive information, giving the attacker access to the victim's crypto assets. It could also be regarding the credentials of centralized exchanges (essentially any credential). LastPass, a web3 platform used for password saving, was hacked reportedly due to keylogger malware. 13 | 14 | Web3 Example: **General Bytes -** Estimated Loss: ~$1.8 Million 15 | 16 | On March 17 and 18, the cryptocurrency ATM service General Bytes was targeted in a cyberattack. The attacker used the system's upload interface to upload and execute a malicious Java program, which allowed them to gain database permissions on the server as well as access to the hot wallet withdrawal API key. 17 | 18 | As a result: 19 | 20 | - The API keys to access funds in hot wallets and exchanges could be read and decrypted. 21 | - Funds from the hot wallet could be transferred. 22 | - Usernames and password hashes could be downloaded, and 2FA could be disabled. 23 | - Terminal event logs can be accessed and searched for instances where customers scanned their private key at an ATM. This data was logged in earlier versions of the ATM software. 24 | 25 | ### Mitigation 26 | 27 | To mitigate the risk of malware attacks, individuals and organizations should take steps such as using reputable antivirus software and keeping it up to date, avoiding downloading software or files from untrusted sources, and regularly backing up important data to prevent loss in the event of an attack. 28 | 29 | It's also essential to stay informed about the latest threats and vulnerabilities and to implement strong security measures such as multi-factor authentication and regular password changes. 30 | 31 | Source: [https://arstechnica.com/information-technology/2023/02/lastpass-hackers-infected-employees-home-computer-and-stole-corporate-vault/](https://arstechnica.com/information-technology/2023/02/lastpass-hackers-infected-employees-home-computer-and-stole-corporate-vault/) -------------------------------------------------------------------------------- /oswar/initial_access/on-chain_scams.md: -------------------------------------------------------------------------------- 1 | # 7. On-chain Scams 2 | 3 | Category: User Target 4 | Tags: Initial Access 5 | 6 | ### What are “On-chain Scams?” 7 | 8 | On-chain Scams are a type of cyberattack that targets users of Web3 technology. In this case, attackers create a fake project or platform, such as a decentralized application (dApp) or a non-fungible token (NFT) mint, to lure victims into connecting their wallets. Once the victim connects their wallet, the malicious smart contract automatically drains the user's funds without their knowledge or consent. 9 | 10 | ### Example: 11 | 12 | An attacker sets up a fraudulent NFT marketplace that imitates a popular and legitimate platform. They promote the fake marketplace through social media, forums, and email campaigns. Unsuspecting users, believing the marketplace to be legitimate, connect their Web3 wallets to the platform. Upon connecting, the malicious smart contract embedded in the fake marketplace executes, withdrawing funds from the connected wallets and transferring them to the attacker's wallet. 13 | 14 | ### Mitigation: 15 | 16 | Verify platform legitimacy: Before connecting your wallet to a platform, ensure that it is a legitimate and trusted platform by checking its URL, reading reviews, checking etherscan, using smart contract reviewing tools, and seeking explanations of the smart contract from trusted sources. 17 | 18 | Be cautious with links: Avoid clicking on links from unknown sources or that appear suspicious, and always double-check URLs before entering sensitive information. 19 | 20 | Educate yourself: Stay informed about the latest security threats and best practices for safeguarding your digital assets. The more you know, the better you can protect yourself from phishing attacks and other types of cyber threats. -------------------------------------------------------------------------------- /oswar/initial_access/phishing.md: -------------------------------------------------------------------------------- 1 | # 1. Phishing 2 | 3 | Tags: Initial Access 4 | 5 | ## What is Phishing? 6 | 7 | Phishing is a social engineering attack where an attacker poses as a legitimate entity or website to trick a victim into revealing sensitive information, like login credentials and personal data. Phishing is part of the "initial access" tactic within the framework for Web3. 8 | 9 | The most common tactic for initial access to a Web3 network or platform is targeted phishing attacks, which aim to obtain a private key. These attacks may involve sending emails or messages that appear to be from a legitimate source to reveal information or download malware. 10 | 11 | ## Example 12 | 13 | An example of a phishing attack in the context of Web3 could be a phishing link sent to a developer of a decentralized exchange (DEX) platform. The developer may be prompted to click on a link that downloads malware or keylogger on their computer. 14 | 15 | ## Mitigation 16 | 17 | Organizations and individuals can take several steps to mitigate the risk of phishing attacks within the initial access tactic: 18 | 19 | 1. Educate users: Provide awareness training on identifying and avoiding phishing emails and websites. Encourage users to report suspicious messages to IT or security teams. 20 | 2. Implement email filters: Use email filtering software to block messages from known phishing domains. Identify and quarantine suspicious messages for review. 21 | 3. Enable two-factor authentication: Require users to use two-factor authentication (2FA) when accessing Web3 platforms and services to provide an additional layer of security and prevent unauthorized access. 22 | 4. Verify website URLs: Always check the URL of a website before entering login credentials or other sensitive information. Ensure it is a legitimate site and not a fake one. 23 | 5. Use security tools: Use web filters, firewalls, and anti-virus software to prevent access to malicious websites. Detect and block phishing attempts. -------------------------------------------------------------------------------- /oswar/initial_access/server_access.md: -------------------------------------------------------------------------------- 1 | # 3. Server access 2 | 3 | Tags: Initial Access 4 | 5 | ### What is Server Access? 6 | 7 | In Web3, servers are often used to host databases and other information related to a blockchain network or dApp (decentralized application). A vulnerability in the server can give attackers the ability to access sensitive information or even take control of the network. 8 | 9 | A decentralized exchange (DEX) in Web3 is typically built on top of a blockchain network, such as Ethereum or Binance Smart Chain. As such, the core functionality of a DEX is executed on the blockchain, and there is no central server involved. 10 | 11 | However, there are other components of a DEX that may require a centralized server. For example, the front-end user interface, order book management, or API endpoints may be hosted on a centralized server. These servers can be vulnerable to attacks such as server access, and it's important to secure them properly. 12 | 13 | ### Example 14 | 15 | As for examples of dApps that use centralized servers, there are many in the Web3 space. Some popular dApps, such as Uniswap or PancakeSwap, may use Amazon Web Services (AWS) or other cloud hosting services for their centralized components. However, it's worth noting that many dApps are designed to be fully decentralized and do not rely on centralized servers. 16 | 17 | It's important to note that even if a dApp uses a centralized server, it doesn't necessarily mean it's less secure. Proper security measures such as encryption, access controls, and regular audits can help mitigate the risks of server vulnerabilities. 18 | 19 | An example of server access in Web3 could be an attacker exploiting a vulnerability in the server hosting a popular decentralized exchange (DEX) or part of its infrastructure to gain access to user funds or sensitive information. 20 | 21 | ### Mitigation 22 | 23 | To mitigate the risk of server access attacks, it's important to implement robust security measures such as regularly updating software, using strong passwords and access controls, and conducting regular security audits. Additionally, utilizing decentralized and cryptographically secure storage and hosting solutions like IPFS can reduce the risk of centralization and single point of failure. 24 | 25 | Hackers may look for vulnerabilities in servers that host Web3 platforms or applications. Servers are databases that host a lot of information. These vulnerabilities could allow them to gain unauthorized access to the server and, in turn, the Web3 network or platform. 26 | 27 | Although much more prominent in the Web3 world as many dApps are on-chain and the blockchain itself functions as the server. Depending on the blockchain and infrastructure of a given dApp, hosting servers may be used. Still, to eliminate centralization, the projects commonly use storage and hosting solutions such as ipfs which are decentralized and cryptographically secure. These types of exploits are, therefore, rare in Web3. -------------------------------------------------------------------------------- /oswar/initial_access/validator_priviliges.md: -------------------------------------------------------------------------------- 1 | # 4. Validator Priviliges 2 | 3 | Tags: Initial Access 4 | 5 | ### What are Validator Privileges? 6 | 7 | Validator privileges refer to elevated access and control validators have in a blockchain network or protocol. Validators are responsible for validating transactions, creating new blocks, and maintaining the integrity of the blockchain. They can also be given extra privileges, such as updating the price of an oracle or staking several tokens. As a result, they have privileged access to the network and can potentially exploit vulnerabilities to gain unauthorized access or execute attacks. 8 | 9 | ### **Example** 10 | 11 | The BonqDAO hack is a prime example of how attackers can exploit validator privileges to execute attacks. The attacker became a validator and updated the price feed for (wrapped) WALBT collateral by staking 10 TRB tokens (worth just ~$175). This allowed the attacker to borrow against inflated collateral in the same transaction, resulting in a significant financial loss for the BonqDAO protocol. 12 | 13 | Staking made the hacker a validator with privileged access to update the price. Since a vulnerability enabled the hacker to update the price instantly, the attacker borrowed against the inflated collateral in the same transaction. The attacker used the submit Value function to report the WALBT price to the oracle. The anonymous attacker got away with around $2M. Essentially, the Polygon-based lending and stablecoin protocol BonqDAO was hit by a two-stage attack on Wednesday in another example of oracle manipulation. 14 | 15 | - Another hack that included validator access occurred in the Binance bridge hack in 2022. 16 | 17 | ### **Mitigation** 18 | 19 | To mitigate these risks, consider the following measures: 20 | 21 | - Implement strict access controls: Limit access to validator nodes by stricter criteria, even if this results in less decentralization. 22 | - Implement continuous monitoring and logging: This allows security teams to detect suspicious activity and respond quickly to potential threats. It is essential to monitor all network activity, including validator nodes, and log all events, including authentication attempts, network traffic, and system events. 23 | - Implement smart contract best practices: Smart contracts are one of the most vulnerable components of a blockchain network. It is essential to follow best practices to reduce the risk of vulnerabilities. This includes using well-audited smart contract libraries, limiting complex logic in smart contracts, and ensuring that all code is thoroughly tested and audited. 24 | - Conduct regular security audits and penetration testing: This involves testing the network for vulnerabilities and identifying potential attack vectors. Independent third-party security firms should conduct security audits and penetration testing to identify and address all potential vulnerabilities. 25 | - Implement security protocols for cross-chain transactions: Cross-chain transactions can be especially vulnerable to attacks, and it is essential to implement security protocols to protect against these attacks. This includes using secure communication protocols, validating transaction signatures, and implementing time-locking mechanisms to prevent attackers from exploiting vulnerabilities in one chain to attack another. 26 | - 27 | 28 | Source: [https://rekt.news/bonq-rekt/](https://rekt.news/bonq-rekt/) -------------------------------------------------------------------------------- /oswar/initial_access/zero_transfer_phishing.md: -------------------------------------------------------------------------------- 1 | # 2. Zero Transfer Phishing 2 | 3 | Category: User Target 4 | Tags: Initial Access 5 | 6 | ### What is Zero Transfer Phishing? 7 | 8 | Illicit smart contracts generate "transfers" of zero-value tokens from the addresses of victims to fake addresses that resemble those with which the victims had previously interacted. The "transfers" have zero value because they don't actually represent the transfer of any tokens. As a result, they can be processed without the usual consent from the source or the victim's wallet. 9 | 10 | The goal is to deceive the victim into mistakenly being sent to the attacker's fake address rather than the legitimate one they had previously communicated with. How does that function? Because many users frequently examine their transaction history to determine which addresses they have once sent to and copy and paste this address from the most recent transaction the victim submitted to it while setting up a new transaction. And how do the majority of users verify that an address is accurate? To ensure that the wallet address is constant throughout their previous transactions, they will swiftly scan the first and final few characters. They frequently need to evaluate and compare every character. 11 | Scan, Copy, Paste, Theft! 12 | 13 | This type of hack is targeted at individuals and EOA wallets. 14 | 15 | ### Example 16 | 17 | A real-world example and explanation can be found on the Coinbase blog: 18 | 19 | [https://www.coinbase.com/blog/zero-transfer-phishing-part-1-attack-analysis](https://www.coinbase.com/blog/zero-transfer-phishing-part-1-attack-analysis) 20 | 21 | ### Mitigation 22 | 23 | To prevent falling for Zero Transfer Phishing, triple-check that the wallet or contract address you are interacting with is correct. Do not only check the last numerals/letters in the address. 24 | 25 | As Coinbase mentions in their article, there are other mitigation techniques: 26 | 27 | - Verify the entirety of the address before sending. Attackers may have generated a vanity address to resemble a legitimate one closely. 28 | - Be mindful about copying addresses from transactions that you did not originate or that look suspicious. Existing ERC-20 tokens will continue allowing zero transactions to and from arbitrary transactions. 29 | - Use blockchain explorers (e.g., Etherscan) and wallets (e.g., Coinbase Wallet) which flag or filter malicious transactions and addresses. 30 | 31 | Blockchain explorers and wallets can implement the following approaches to help shield consumers from this and similar threats: 32 | 33 | - Flag or filter transfer events with the value set to 0. Consider derivative exploitation vectors for non-ERC-20 transfer events (e.g. NFTs, staking, etc.). 34 | - Implement address mask collision detection to identify similar addresses unlikely to have been generated randomly (e.g., same N first and last characters). 35 | - If shortening addresses, consider including 3+ bytes on each side to make mass vanity generation harder (e.g. 0x123456...abcdef). 36 | - Alert users on new/unknown addresses when initiating transfers. 37 | 38 | --- 39 | 40 | [Zero Transfer Phishing - Part 1 - Attack Analysis - Blog](https://www.coinbase.com/blog/zero-transfer-phishing-part-1-attack-analysis) -------------------------------------------------------------------------------- /oswar/lateral_movement/bridge_exploits.md: -------------------------------------------------------------------------------- 1 | # 3. Bridge exploits 2 | 3 | Category: Cross Chain 4 | Tags: Lateral Movement 5 | 6 | ### Understanding "Bridge Exploits" 7 | 8 | A bridge is a tool that allows for communication between two different blockchain networks. Bridge hacks occur when attackers gain entry to one network and use it to access other connected networks through the bridge. This allows attackers to move laterally through the environment and access valuable assets on different blockchain networks. 9 | 10 | ### Example: 11 | 12 | In 2021, the Poly Network, a decentralized finance platform, was hacked through a vulnerability in its smart contract. The attackers were able to steal over $600 million worth of cryptocurrencies across three different blockchains: Ethereum, Binance Smart Chain, and Polygon. The attackers used the stolen funds to create new smart contracts on each of the three blockchains to move the stolen assets around, making it more difficult to track and recover the funds. 13 | 14 | # Mitigation: 15 | 16 | To prevent bridge hacks, it is important to secure both ends of the bridge and ensure that communication between the two blockchain networks is secure. This can be achieved through measures such as implementing secure smart contracts, using multi-signature wallets, and conducting regular security audits. 17 | 18 | It is also important to monitor for any suspicious activity and have a plan in place to respond to any potential breaches quickly. -------------------------------------------------------------------------------- /oswar/lateral_movement/compromised_nodes.md: -------------------------------------------------------------------------------- 1 | # 2. Compromised nodes 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Lateral Movement 5 | 6 | # What are "compromised nodes"? 7 | 8 | Compromised nodes are nodes within a blockchain network that an attacker has gained control of, often through a vulnerability or misconfiguration. Once an attacker has control of a node, they can use it to pivot to other nodes or systems within the same network, giving them access to valuable assets. 9 | 10 | This access can allow attackers to move laterally through the environment and manipulate the network. 11 | 12 | ## Example 13 | 14 | For instance, an attacker who gains control of a node in a DeFi protocol can access the protocol's smart contracts and execute transactions on the protocol's behalf. This enables them to move laterally within the protocol's network and gain access to valuable assets such as user funds, governance tokens, or private data. 15 | 16 | ## Mitigation 17 | 18 | To mitigate the risk of compromised nodes, it is crucial to have a strong security posture in place. This includes regularly updating software and patches, using strong passwords, and limiting access to sensitive systems. Additionally, monitoring network traffic and system logs can help detect any suspicious activity and enable prompt response. Implementing a defense-in-depth approach, which involves layering multiple security mechanisms to prevent and detect attacks, is also recommended. This can include firewalls, intrusion detection systems, security information, and Rreal-time analysis tools. -------------------------------------------------------------------------------- /oswar/lateral_movement/multi-chain_attacks.md: -------------------------------------------------------------------------------- 1 | # 1. Multi-Chain Attacks 2 | 3 | Category: Cross Chain 4 | Tags: Lateral Movement 5 | 6 | ### What are "Multichain attacks"? 7 | 8 | A "multichain attack" occurs when an attacker gains access to one blockchain network or dApp and then uses that access to pivot to other connected blockchain networks or dApps. This allows the attacker to move laterally through the environment and access valuable assets. 9 | 10 | Within a lateral movement, multichain attacks refer to an attack tactic where an adversary gains access to one blockchain network or dApp, then moves laterally across multiple connected blockchain networks or dApps to reach their ultimate target. This tactic allows attackers to broaden their attack surface and access valuable assets across multiple blockchain networks. 11 | 12 | ### Example 13 | 14 | An example of a multichain attack within the lateral movement could involve an attacker gaining access to and exploiting a bug in a decentralized exchange (DEX) on one blockchain network and then using that access/bug exploit to pivot to other connected chains. 15 | 16 | ### Mitigation 17 | 18 | To mitigate multichain attacks within the lateral movement, it is important to implement strong access controls and monitoring tools to detect and prevent unauthorized access and movement within blockchain networks. This includes using multi-factor authentication, implementing network segmentation to restrict lateral movement, and conducting regular security audits and vulnerability assessments to identify and address potential weaknesses. Additionally, organizations should consider implementing blockchain-specific security solutions, such as smart contract audits and token whitelisting, to reduce the risk of multichain attacks within the lateral movement. -------------------------------------------------------------------------------- /oswar/persistence/backdoor.md: -------------------------------------------------------------------------------- 1 | # 2. Backdoor 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Persistence 5 | 6 | What is a “backdoor”? 7 | 8 | One example of a persistence attack in Web3 where a hacker gains complete control over a network, or dApp is a "backdoor" attack. This attack involves inserting a hidden access point, or "backdoor," into a network or application that allows the attacker to bypass normal authentication and gain complete control over the system. 9 | 10 | In a blockchain context, a backdoor could be inserted into the smart contract code, allowing the attacker to execute arbitrary code on the blockchain and manipulate its state. For example, the attacker could create new transactions, transfer funds, or change the ownership of assets without the knowledge or consent of the legitimate users of the blockchain. 11 | 12 | Backdoors are secret entry points to a system or software that allow unauthorized access. In the context of Web3, backdoors can be used to gain persistent access to a smart contract, wallet, or other decentralized application, enabling attackers to steal funds or data. 13 | 14 | Example 15 | 16 | Not so common in the crypto world, especially DeFi; we may have a huge example in CeFi. Rumors had it that the FTX collapsed, not due to a private key, but due to a backdoor established inside FTX system by SBF himself. 17 | 18 | Source: [https://www.businessinsider.com/sam-bankman-fried-secret-backdoor-worth-65-billion-court-hears-2023-1](https://www.businessinsider.com/sam-bankman-fried-secret-backdoor-worth-65-billion-court-hears-2023-1) 19 | 20 | Mitigation 21 | 22 | Web3 technology is still evolving, and while it offers many advantages over traditional web technologies, it also presents new security challenges. Backdoors are one such challenge that remains a challenge, and they can allow attackers to gain unauthorized access to web3 systems and exploit vulnerabilities for their own purposes. Here are some ways to mitigate backdoors in web3. 23 | 24 | It is also important to ensure all developers in a project are to be trusted. They can implement malicious code intentionally, without authority. 25 | 26 | Backdoors can actually be introduced unintentionally during the development process. By following secure development practices, such as using secure coding techniques, conducting regular code reviews, and performing thorough testing, you can reduce the risk of introducing backdoors into your web3 applications. 27 | 28 | Follow best practices for smart contract development: Smart contracts are an integral part of many web3 applications and are through malicious smart contracts and/or loopholes that the backdoor access would be. It is, in this case, highly important to monitor and check the contracts for any backdoor access to unauthorized wallets. -------------------------------------------------------------------------------- /oswar/persistence/contract_ownership_changes.md: -------------------------------------------------------------------------------- 1 | # 1. Contract Ownership Changes 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Persistence 5 | 6 | What is a “Contract Ownership Change”? 7 | 8 | Contract Ownership Change is a type of attack in the context of decentralized applications (dApps) built on the Ethereum blockchain or other Web3 platforms. A smart contract is a self-executing program that runs on the blockchain and can manage assets and transactions without a centralized authority. In this type of attack, an attacker changes the ownership of a smart contract, granting them full control over it. This can allow them to modify or destroy the contract, steal funds or data, or execute other malicious actions. 9 | 10 | In this type of attack, the attacker gains control over the ownership of a smart contract, either by exploiting a vulnerability in the contract code or by gaining access to the private keys of the contract owner. Once the attacker becomes the contract owner, they can execute any contract function, including modifying its code, stealing funds or data, or destroying the contract entirely. The change of contract ownership enables the attacker to establish a real foothold within the DApp/protocol. 11 | 12 | Example: 13 | 14 | Imagine a dApp that manages a decentralized exchange where users can trade cryptocurrencies. The smart contract that powers the exchange has a function that allows the contract owner to withdraw all the funds held in the exchange. If an attacker gains control over the contract ownership, they can call this function and steal all the funds stored in the exchange. 15 | 16 | Mitigation 17 | 18 | To mitigate Contract Ownership Changes attacks, dApp developers should follow security best practices when coding their contracts, such as using established security frameworks, conducting thorough code audits, and implementing multi-signature mechanisms for critical functions. Additionally, dApp users should be cautious when interacting with smart contracts and only use trusted applications thoroughly audited and reviewed by the community. 19 | 20 | The best tip, in this case, would be to implement real-time and proactive monitoring of the contract owner wallet, which essentially is the key central access to the entire dApp/protocol. Real-time monitoring can prevent the entire ownership by alerting the owner contract dApp/protocol in real time. It could even front-run the entire transaction by detecting it in the mempool. 21 | Real-time monitoring can also, in this case, be used to prevent further harm once the attacker has managed to establish his foothold and gain access to the wallet. -------------------------------------------------------------------------------- /oswar/persistence/rugpull.md: -------------------------------------------------------------------------------- 1 | # 2. Rugpull 2 | 3 | Category: Malicious Deployment 4 | Tag: Persistence 5 | 6 | ### What is a Rugpull? 7 | A rugpull is a type of scam in the cryptocurrency and DeFi (Decentralized Finance) space where project developers abruptly pull the plug on their project and abscond with the users’ funds. This usually involves the manipulation of smart contracts or other mechanisms in a DeFi protocol. Once the rugpull occurs, users are left with worthless tokens and no means to recover their funds. 8 | The name “rugpull” comes from the metaphor of a rug being pulled out from under a person, implying a sudden and unexpected action that leaves the victim off balance and helpless. 9 | 10 | ### Case Study of Kokomo Finance Exploit 11 | On March 27, 2023, Kokomo Finance, a lending protocol on the Optimism blockchain, performed a rugpull and disappeared with approximately $4 million worth of tokens, mostly in the form of Wrapped Bitcoin (WBTC). The exploit involved a malicious contract modification made by the project’s deployer address, which rugged Wrapped Bitcoin deposits. Shortly after the rugpull, the project’s online presence, including its website, Twitter, GitHub, and Medium, was deleted. 12 | The steps to reproduce the exploit, as well as transaction analysis and identified rugpull indicators, are described above. 13 | 14 | ## Rugpull according to STRIDE and MITRE 15 | This exploit can be categorized according to the STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege) model and the MITRE ATT&CK (Adversarial Tactics, Techniques, and Common Knowledge) framework as follows: 16 | - **STRIDE Category**: `Tampering`. The attacker modified the smart contract to redirect WBTC to their own address. 17 | - **MITRE ATT&CK Tactic**: `Impact`. The attacker’s goal was to cause financial loss to the users of the protocol and drain all the funds. 18 | - **MITRE ATT&CK Technique**: Endpoint Denial of Service (T1499). By modifying the smart contract, the attacker effectively made the protocol unavailable for legitimate users to withdraw their funds. 19 | - Many a times it is noticed that the attackers used upgradable proxies and admin functions to make external calls to a malicious contract controlled by them & drain complete funds from the protocols vault. 20 | 21 | ## Mitigation 22 | Preventing rugpulls can be challenging due to the decentralized and permissionless nature of DeFi. However, there are several measures that can be taken to mitigate the risk of rugpulls: 23 | - **Anonymous or unknown team** : 24 | A team that is anonymous or unknown should be a red flag as they may not have any reputation to uphold and can disappear easily. 25 | 26 | - **Unaudited code** : 27 | A smart contract that has not been audited or reviewed by reputable third-party auditors increases the risk of vulnerabilities and potential exploits. 28 | 29 | - **Centralized control**: 30 | A smart contract that gives excessive control to the owner or a small group of individuals can lead to potential misuse of funds or a rugpull. 31 | 32 | - **Lack of transparency**: 33 | A rugpull often involves a lack of transparency or information on the project, such as unclear tokenomics or a lack of information on the team or project roadmap. 34 | 35 | - **Unrealistic promises**: 36 | Projects that make unrealistic promises of high returns or quick profits without a clear explanation of how these returns will be generated should be approached with caution. 37 | 38 | - **Lack of liquidity**: 39 | If a project has low liquidity or a small number of holders, it may be easier for a rugpull to occur as there may not be enough holders to prevent a large-scale dump. 40 | 41 | - **Sudden changes or delays**: 42 | A sudden change in the project roadmap or significant delays in project milestones without proper communication to investors can be a warning sign of a potential rugpull. 43 | 44 | ### Reference: 45 | https://rekt.news/kokomo-finance-rekt/ 46 | -------------------------------------------------------------------------------- /oswar/privilege_escalation/blockchain_node_hijacking.md: -------------------------------------------------------------------------------- 1 | # 2. Blockchain Node Hijacking 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Privilege Escalation 5 | 6 | What is Blockchain Node Hijacking? 7 | 8 | Blockchain nodes are critical components of the web3 infrastructure. In this attack, an attacker takes over a blockchain node to gain control of the network. Once control is gained, the attacker can manipulate transactions and potentially steal funds. 9 | 10 | Blockchain Node Hijacking is a type of Privilege Escalation attack that aims to compromise and gain control of the blockchain network by hijacking a node responsible for validating transactions or mining blocks. In this attack, the attacker attempts to take over the blockchain node, which can lead to complete control over certain parts of the blockchain network. 11 | 12 | Example 13 | 14 | Blockchain nodes can potentially be compromised if the device or server on which they are stored is vulnerable to attacks. However, running a blockchain node on dedicated hardware can reduce the risk of compromise as it isolates the node from other processes running on the same device. Additionally, blockchain nodes are designed to be resistant to attacks and can detect and reject any invalid or fraudulent transactions. However, if an attacker gains control of a majority of the nodes in a blockchain network, they could potentially manipulate the transactions and undermine the security and integrity of the blockchain network. 15 | 16 | Prevention 17 | 18 | To prevent Blockchain Node Hijacking, it is essential to implement strong security measures that prevent unauthorized access to the blockchain node. Some ways to prevent this attack include: 19 | 20 | 1. Limiting access to the blockchain node to authorized personnel only. 21 | 2. Implementing strong authentication mechanisms such as two-factor authentication (2FA) or multi-factor authentication (MFA). 22 | 3. Encrypting all data transmissions between nodes and network peers. 23 | 4. Regularly updating and patching the blockchain node's software to prevent known vulnerabilities from being exploited. 24 | 5. Monitoring the network for suspicious activities and implementing security controls to detect and prevent malicious activities. 25 | 6. Having sufficient decentralization and Node parameters in place. 26 | 27 | By implementing these security measures, organizations can reduce the risk of Blockchain Node Hijacking and ensure the security of their blockchain network. -------------------------------------------------------------------------------- /oswar/privilege_escalation/governance_exploit_(dao_takeover).md: -------------------------------------------------------------------------------- 1 | # 3. Governance exploit (DAO takeover) 2 | 3 | Category: Logic 4 | Tags: Privilege Escalation 5 | 6 | ### What is a "Governance Exploit"? 7 | 8 | In the case of DAOs, a governance exploit can occur when a hacker gains control of a governance contract or a malicious proposal is voted into effect. This can allow the hacker to gain administrative control over the DAO, allowing them to manipulate or steal assets held by the organization or implement overrides. 9 | 10 | A DAO, or Decentralized Autonomous Organization, is a type of organization that operates through smart contracts on a blockchain. A DAO can be taken over when an attacker gains control of a sufficient number of voting rights/tokens or other governance exploit methods to influence the decision-making process of the organization. This essentially depends on the rules embedded into the governance structure itself. 11 | 12 | ### Example: 13 | 14 | In a DAO takeover attack, the attacker seeks to gain control of the organization's governance process by either stealing tokens, performing flash loans, or gaining access to the private keys of a significant number of members. Once the attacker gains control, they can propose and vote on malicious proposals that could grant them additional privileges or access to the organization's assets. Flash loans, in this case, are the most popular method of gaining a sufficient amount of tokens to override a proposal. 15 | 16 | A real-world example is **Beanstalk DAO**, which was exploited in 2022. 17 | 18 | Beanstalk is a DeFi network with its stablecoin $BEAN at the center of it. In April 2022, a malicious governance attack using a flash loan resulted in the theft of $182 million. In this case, PeckShield was the first to discover that the attacker used Beanstalk's majority rules governance system to steal the $182 million. 19 | 20 | The attacker seized majority control of the protocol's governance with a flash loan of $1 billion from Aave, Uniswap, and SushiSwap. They gained enough voting power (majority rules) by swapping the funds and depositing them in the Beanstalk protocol liquidity pools, making it possible to call the emergencyCommit function and trigger an emergency governance execution. The attack leveraged the lack of delay between voting and execution to pass a malicious proposal that transferred deposited funds to the attacker's address. With these steps, the attacker made $80 million in profits. 21 | 22 | ### Mitigation 23 | 24 | The purpose of a DAO is to create decentralized governance practices and rules, and even though it is a noble intent, it can be exploited by malicious parties. Essentially, a DAO wants to enable the majority to implement changes in the future direction of a given protocol. However, this presents numerous vulnerabilities because one person can exploit and cheat themselves to power, even though they follow the rules of the DAO itself. 25 | 26 | To prevent a DAO takeover, it is essential to ensure that the logic of the governance structure is set up correctly and implement other robust measures. Since the whole idea is to keep the organization decentralized, mitigation strategies like limiting access to trusted individuals are not an option. 27 | 28 | In these scenarios, each DAO is architected differently, which presents new vulnerabilities. Some have added mechanisms, limits, or rules that may present a point of manipulation. It is crucial to regularly review and audit the government contracts of the organization to identify and mitigate potential vulnerabilities. In case of an attack, it is essential to have a response plan in place to quickly mitigate the damage and restore control over the organization. 29 | 30 | Real-time monitoring of the DAO smart contracts is also essential for detecting malicious activities. -------------------------------------------------------------------------------- /oswar/privilege_escalation/guardian_takeover.md: -------------------------------------------------------------------------------- 1 | # 4. Guardian takeover 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Privilege Escalation 5 | 6 | ### What is a “Guardian takeover”? 7 | 8 | A guardian takeover attack is a type of attack in which a hacker gains control of the guardian account for a decentralized application (dApp). This enables them to manipulate the smart contract that governs the dApp's operations and have complete control over the dApp. Such an attack can lead to theft of funds, modification of the contract's rules, or a complete shutdown of the dApp. 9 | 10 | In a dApp, a guardian is a designated party responsible for managing the smart contract that governs the dApp's operations. A guardian takeover attack occurs when a hacker gains control of the guardian account, allowing them to manipulate the smart contract and have complete control over the dApp. Once they have control, they can potentially steal funds, modify the contract's rules in their favor, or shut down the dApp entirely. 11 | 12 | ### Example: 13 | 14 | The Ronin Network hack of 2022 serves as an example of a Guardian Takeover attack. 15 | 16 | The Axie Infinity blockchain gaming application gained a lot of popularity and was developed on the Ronin Network. Unfortunately, Ronin suffered one of its worst hacks in March 2022, when a malicious actor was able to quickly obtain 173,600 ether ($ETH) and 25.5 million USDC, which were later exchanged for $625 million. The hacker managed to get hold of the necessary private keys and consequently stole all the funds from the Ronin Bridge in just two transactions, making it one of the most significant DeFi breaches to date. 17 | 18 | The Ronin Bridge was operated by nine "validators," with a five out of nine threshold. Sky Mavis (the company behind Axie Infinity) oversaw four validators, so the private keys weren't distributed enough. Furthermore, Axie delegated their validator's signature to Sky Mavis in November 2021. Although this delegation was supposed to be temporary because Axie was experiencing heavy traffic, it was never revoked. Sky Mavis ended up with five validator signatures, enough to approve any message. Through a social-engineering attack, the attacker obtained control of the keys. They could call withdrawERC from the bridge without a backing transaction on the other side once they had the keys. 19 | 20 | ### Mitigation: 21 | 22 | Decentralization is a crucial feature of all dApps. This makes it more challenging for a single entity to gain control of the network. But the access points to get control of the dApp can still be exploited or compromised. To prevent guardian takeover attacks, strong security measures are required, including: 23 | 24 | - Proper access controls: Implementing proper access controls for guardians and validators can help prevent unauthorized access to sensitive areas of the dApp, reducing the risk of attacks. 25 | - Regular security audits: Conducting regular security audits can help identify vulnerabilities in the dApp's code and infrastructure, allowing for them to be addressed before they can be exploited. 26 | - Multi-signature authorization: Implementing multi-signature authorization can help prevent guardian takeover attacks by requiring multiple parties to authorize certain actions, such as fund transfers or changes to the smart contract. 27 | - Emergency protocols: Implementing emergency protocols can help prevent or mitigate the impact of attacks by allowing for quick action in the event of an attack. 28 | - Real-time monitoring: Implementing proactive security measures such as real-time monitroing is essential to be alerted int eh case of a potential attack. 29 | 30 | In summary, preventing guardian takeover attacks requires strong security measures, including decentralization, robust consensus mechanisms, proper access controls, regular security audits, multi-signature authorization, and emergency protocols. By taking a comprehensive approach to security, it is possible to reduce the risk of attacks and protect the integrity of the dApp. -------------------------------------------------------------------------------- /oswar/privilege_escalation/smart_contract_ownership_override.md: -------------------------------------------------------------------------------- 1 | # 1. Smart Contract Ownership Override: 2 | 3 | Category: Higher Privilige Attacks 4 | Tags: Privilege Escalation 5 | 6 | What is the "smart contract ownership override"? 7 | 8 | In this attack, an individual exploits a vulnerability in a smart contract to gain ownership. Once they have ownership, they can alter the contract to their preference, including providing greater access and control. 9 | 10 | Smart contract override is a privilege escalation attack targeting smart contracts on a blockchain network. It is initiated when an attacker exploits a smart contract or network vulnerability that allows them to gain unauthorized access and control over the contract's operations. The attacker can then modify the contract's code, move funds, and execute malicious functions without the contract owner's awareness or permission. In the Web3 framework, smart contract override is classified as a privilege escalation attack. This is because the attacker gains elevated privileges over the smart contracts, enabling them to perform actions they would not typically have access to. 11 | 12 | Here is an example: 13 | 14 | Let's consider a smart contract that sets the price of a commodity such as real estate. 15 | 16 | ``` 17 | // SPDX-License-Identifier: MIT 18 | pragma solidity 0.8.9; 19 | contract RealEstatePrice { 20 | uint256 public apartmentprice; 21 | 22 | constructor(uint256 _price) { 23 | apartmentprice = _price; // default 24 | } 25 | 26 | function updateApartmentPrice(uint256 _price) external { 27 | apartmentprice = _price; 28 | } 29 | } 30 | 31 | ``` 32 | 33 | *"The contract defined above is a simple real estate price. The constructor sets the default price for the apartment. The `updateApartmentPrice()` function updates the apartment price with the new one. The contract appears innocent; however, if you observe closely, the function `updateApartmentPrice()` is an external function and can be called by anyone (attacker) apart from the deployer or the owner to update the apartment pricing. This is a simple and classic example of an ownership attack where an attacker can call a function to update the value and easily exploit it."* 34 | 35 | Mitigating 36 | 37 | To prevent smart contract override attacks, there are several best practices that developers can follow: 38 | 39 | - Use secure coding practices: Developers should follow secure codes when creating smart contracts, such as input validation, error handling, and parameter checks. 40 | - Add a custom modifier that checks if you are the contract owner and only allows you to update the price in the function. 41 | - Use secure contracts. Some contracts are well-tested, proven, efficient, and widely adopted; we can reuse the owner smart contract, preventing us from rewriting the modifier like above. 42 | - Conduct thorough testing: Developers should conduct thorough testing of smart contracts to identify and address any potential vulnerabilities. 43 | - Implement access controls: Smart contracts should be designed with proper access controls in place to limit the actions that users can perform. 44 | - Use multi-signature wallets: Multi-signature wallets can be used to ensure that any changes to the smart contract require approval from multiple parties. 45 | - Monitor smart contracts: Regularly monitoring smart contracts can help identify any unauthorized access or modifications to the contract's code. 46 | 47 | --- 48 | 49 | Source: [https://blog.finxter.com/smart-contract-security-series-part-1-ownership-exploit/](https://blog.finxter.com/smart-contract-security-series-part-1-ownership-exploit/) -------------------------------------------------------------------------------- /oswar/reconnaissance/api_endpoints.md: -------------------------------------------------------------------------------- 1 | # 4. API endpoints 2 | 3 | Category: Infrastructure 4 | Tags: Reconnaissance 5 | 6 | ### What are API endpoints? 7 | 8 | API endpoints are a key target for reconnaissance, as they can provide valuable information about the dApp's functionality and underlying blockchain network. An API endpoint is a URL that can be accessed to interact with a specific component of the dApp, such as a smart contract or a node on the blockchain network. 9 | 10 | ### Example 11 | 12 | An attacker may use an API endpoint to gather information about a smart contract's functions and input parameters, which could reveal vulnerabilities that can be exploited to manipulate or steal assets from the contract. 13 | 14 | ### Mitigation 15 | 16 | To mitigate the risk of reconnaissance attacks, dApp developers should take several steps. First, they should ensure that sensitive information is not exposed through API endpoints, such as private keys or other authentication credentials. Developers should also ensure the API keys are secure. 17 | 18 | - Developers can also implement rate limiting and IP blocking to prevent automated reconnaissance attacks. 19 | 20 | Additionally, developers can use obfuscation techniques to make it more difficult for attackers to extract information from API endpoints, such as using random identifiers for function names or input parameters. Finally, developers should regularly audit their dApp and blockchain networks for potential vulnerabilities and implement patches to stay ahead of attackers. -------------------------------------------------------------------------------- /oswar/reconnaissance/malware.md: -------------------------------------------------------------------------------- 1 | # 3. Malware 2 | 3 | Category: Malware based 4 | Tags: Reconnaissance 5 | 6 | ### What is Malware? 7 | 8 | “Malware” refers to any software or code designed to gain unauthorized access to an organization's systems or steal sensitive information. In the world of Web3, blockchains, and crypto, malware can be particularly dangerous because it can be used to steal private keys, wallet addresses, and other resources that can be used to support an attack. 9 | 10 | It is worth noting that when a hacker successfully installs malware on a target's computer, the Web3 hack has not yet begun. Instead, it is still considered a traditional "Web2" hack aimed at achieving goals that will facilitate a Web3 hack, such as acquiring the private key of a wallet. 11 | 12 | ### Examples: 13 | 14 | One common example of malware in the Web3 context is a keylogger. This type of malware records every keystroke on a device, including passwords, private keys, and other sensitive information. Once captured, the attacker can use this information to access a victim's accounts or wallets. 15 | 16 | Another type of malware commonly used in Web3 attacks is ransomware. This malware encrypts a victim's files or systems, making them inaccessible. The attacker then demands a ransom payment in exchange for the decryption key. In the context of Web3, ransomware can be used to encrypt a victim's wallets or blockchain nodes, making them inaccessible and forcing the victim to pay the ransom to regain access. 17 | 18 | It is worth noting that in many cases, malware is deployed on a target's computer through phishing. A prime example is the Lazarus Group, which ran a fraudulent job advertisement scheme. They posted job openings on sites like LinkedIn and told people who were interested in the job to download a PDF file that contained an executable file inside. This malware enabled Lazarus operatives to exploit vulnerabilities in the victim's system, stealing sensitive data from employees at existing crypto companies. 19 | 20 | ### Mitigation: 21 | 22 | To mitigate the risk of malware attacks, Web3 users should use antivirus and anti-malware software to detect and remove any malicious software from their devices. It is also important to keep software and systems up-to-date with the latest security patches to prevent attackers from exploiting known vulnerabilities. 23 | 24 | Web3 users should also be cautious when downloading and installing software or apps and should only use trusted sources. It is important to verify the authenticity and security of any software, link, or app before downloading it. 25 | 26 | Lastly, Web3 users should implement strong security measures, such as using two-factor authentication, encrypting sensitive information, and limiting access to resources, to reduce the impact of malware attacks. -------------------------------------------------------------------------------- /oswar/reconnaissance/smart_contract_scanning.md: -------------------------------------------------------------------------------- 1 | # 2. Smart Contract Scanning 2 | 3 | Category: Analysis & profiling 4 | Tags: Reconnaissance 5 | 6 | ### What is “smart contract scanning”? 7 | 8 | Smart contract scanning involves analyzing the open-source code of smart contracts, which are self-executing contracts with the terms of the agreement directly written into lines of code on a blockchain, to identify any potential security vulnerabilities. 9 | 10 | ### Example 11 | 12 | A real-world example of why smart contract scanning is important is the DAO (Decentralized Autonomous Organization) hack in 2016. The DAO was a decentralized venture capital fund that raised over $150 million worth of ether, a cryptocurrency used on the Ethereum blockchain. However, a DAO's smart contract code flaw was exploited, allowing an attacker to drain approximately $50 million worth of ether. The hack resulted in a hard fork of the Ethereum blockchain, where a new version was created to reverse the transactions and return the stolen funds. 13 | 14 | This is not the only example. All hacks occur due to a vulnerability of the smart contracts that have at some point been scanned and identified by the hacker. 15 | 16 | ### Mitigation 17 | 18 | It is not possible to prevent the “scanning” of blockchain smart contracts which are open source. 19 | 20 | However, one should perform smart contract audits and bug bounties to mitigate the risk of being hacked. This involves using tools and techniques to analyze the smart contract code for any weaknesses or vulnerabilities that could be exploited by attackers. The goal is to identify potential issues before malicious actors can exploit them. 21 | 22 | In addition to audits, dApps should implement proactive real-time monitoring to scan for malicious activity. This involves AI-based & Machine learning monitoring solutions that scan smart contracts and entire blockchain networks to identify malicious smart contracts being deployed. -------------------------------------------------------------------------------- /oswar/reconnaissance/social_engineering_one.md: -------------------------------------------------------------------------------- 1 | # 1. Social Engineering 2 | 3 | Tags: Reconnaissance 4 | 5 | ### What is “social engineering”? 6 | 7 | Social engineering is the use of psychological manipulation to deceive victims into divulging sensitive information, such as private keys, seed phrases, or passwords. Cybercriminals use this technique to gain unauthorized access to victims' crypto wallets or personal information. 8 | 9 | ### Example 10 | 11 | An example of social engineering in the context of Web3 is pretexting. Pretexting is a tactic where an attacker creates a false identity or scenario to gain the victim's trust and extract sensitive information. 12 | 13 | For instance, a hacker may impersonate an IT technician and contact an employee to request their login credentials, claiming that there is an issue with their account that needs to be resolved. The attacker may use these credentials to access the company's network or steal sensitive data. 14 | 15 | Another form of pretexting occurs when an attacker calls a company's customer service department, pretending to be a customer, and convinces the representative to provide them with confidential information or access to the customer's account. 16 | 17 | A real-world example is the North-Korean Lazarus group, who sent malicious PDFs to Web3 project owners on LinkedIn, pretending to be someone else. 18 | 19 | *”Lazarus Group has been one of the most persistent and dangerous hackers in the cryptocurrency space. In addition to the Ronin bridge exploit, which earned them over $500 million, the North Korean state-sponsored hacking group carried out several other profitable attacks in 2022. Some of the ones that stand out are the [Gate.io](http://gate.io/) exploit and the Harmony Horizon bridge attack. The Lazarus Group ran a fraudulent job advertisement scheme. They posted job openings on sites like LinkedIn and told people who were interested to download a PDF file that had an executable file inside. This malware enabled Lazarus operatives to exploit vulnerabilities in the victim's system, stealing sensitive data from employees at existing crypto companies.”* 20 | 21 | ### Mitigation 22 | 23 | To mitigate the risk of social engineering attacks, it is important to be cautious and vigilant when receiving unsolicited emails or messages. Always verify the sender's authenticity and double-check the URL of any websites you are prompted to visit. 24 | 25 | Additionally, enable two-factor authentication (2FA) on all accounts that support it, and avoid sharing your private keys or seed phrases with anyone, including friends and family. Finally, consider using a hardware wallet to store your crypto assets, as these devices provide an extra layer of security against social engineering attacks. 26 | 27 | To prevent pretexting attacks, organizations can implement strict policies for verifying the identity of individuals who request sensitive information or access. This may involve requiring additional authentication measures, such as passwords or biometric data, or conducting background checks on individuals who request access to sensitive systems. Additionally, employee training and awareness programs can help to educate staff on how to recognize and avoid social engineering attacks. 28 | 29 | Source: Cyvers Web3 Security Report. -------------------------------------------------------------------------------- /oswar/resource_development/brute_force_attack.md: -------------------------------------------------------------------------------- 1 | # 3. Brute Force Attack 2 | 3 | Category: Infrastructure 4 | Tags: Resource Development 5 | 6 | ### What is a "Brute Force attack"? 7 | 8 | A Brute Force attack is a hacking method where attackers use automated software or code to guess passwords, private keys, or other sensitive information. This involves systematically checking every possible combination of characters until the correct one is found. In the context of Web3, blockchains, and crypto, Brute Force attacks can be used to gain access to wallets, accounts, and other resources that can be used to support an attack. Concerning resource development, it refers to creating a tool or method to carry out a Brute Force attack later. 9 | 10 | Brute Force attacks involve using automated software or code to guess passwords, private keys, or other sensitive information. In the context of Web3, blockchains, and crypto, Brute Force attacks can be used to gain access to wallets, accounts, and other resources that can be used to support an attack. 11 | 12 | ### Example: 13 | 14 | A common example of Brute Force attacks in the Web3 context is a dictionary attack on a wallet or account. Dictionary attacks involve an attacker using a list of common words or phrases as passwords and then systematically checking each one until the correct password is found. In the case of Web3, an attacker may use a list of commonly used passwords or private keys to try and gain access to a wallet or account. 15 | 16 | Another example of Brute Force attacks in the Web3 context is a rainbow table attack on a hashed password. Rainbow table attacks involve precomputing the hashes of all possible character combinations and then comparing them to the hash of a target password. The attacker can use the pre-computed password to access the account or wallet if a match is found. 17 | 18 | ### Mitigation: 19 | 20 | To mitigate Brute Force attacks, Web3 users should use strong passwords or passphrases that are difficult to guess. Using unique passwords for each account or wallet is also important to prevent attackers from accessing multiple resources if one password is compromised. 21 | 22 | Additionally, two-factor authentication (2FA) can add an extra layer of security to accounts and wallets, making it more difficult for attackers to gain access. 23 | 24 | Web3 users should also keep their software and systems up-to-date with the latest security patches and use antivirus and firewall software to protect their devices from malware. Monitoring accounts and wallets regularly for any unauthorized access or suspicious activity is also essential. Lastly, blockchain and crypto projects should implement strong security measures, such as password strength requirements, rate limiting, and IP blocking, to prevent Brute Force attacks on their platforms. -------------------------------------------------------------------------------- /oswar/resource_development/credential_stuffing.md: -------------------------------------------------------------------------------- 1 | # 6. Credential Stuffing 2 | 3 | Category: Acquire Private Key 4 | Tags: Resource Development 5 | 6 | --- 7 | 8 | ### What is "Credential Stuffing"? 9 | 10 | Credential stuffing is a technique cybercriminals use to gain unauthorized access to a target's account by using stolen login credentials. This can be used to steal private keys by accessing the target's Web3 wallet or other cryptocurrency-related accounts. Cybercriminals exploit the vulnerability of reused or weak passwords across different accounts to execute this type of cyberattack. Credential stuffing attacks involve automated attempts to log into a target's account using combinations of usernames and passwords obtained from data breaches and other sources. Resource development involves acquiring the credential stuffing tool to carry out the attack. 11 | 12 | Credential stuffing is a popular technique among cybercriminals because it requires minimal effort to execute and can lead to significant financial gain. In the context of Web3 security, credential stuffing can be used to access a target's Web3 wallet or other cryptocurrency-related accounts, enabling the attacker to steal private keys and access funds. 13 | 14 | ### Example 15 | 16 | In 2019, a hacker group compromised 4.9 million Capital One credit card applications by exploiting a vulnerability in the company's firewall. The attackers then used a credential-stuffing attack to access the AWS server containing the stolen data. The attack resulted in the theft of personal information, including names, addresses, credit scores, and Social Security numbers of the affected individuals. 17 | 18 | ### Mitigation 19 | 20 | Organizations can implement several measures to mitigate credential-stuffing attacks, such as strong password policies that require users to create complex passwords and enable two-factor authentication (2FA). Other best practices include monitoring for unusual login attempts and implementing rate-limiting mechanisms to prevent brute-force attacks. Additionally, organizations can use third-party services to monitor and alert them of compromised credentials, allowing them to prompt affected users to change their passwords. Finally, educating users on the dangers of password reuse and encouraging them to use unique passwords across different accounts is essential. 21 | 22 | Source: [https://www.cnbc.com/2019/07/30/capital-one-data-breach-suspect-paige-thompson-had-access-to-servers.html](https://www.cnbc.com/2019/07/30/capital-one-data-breach-suspect-paige-thompson-had-access-to-servers.html) -------------------------------------------------------------------------------- /oswar/resource_development/keylogger.md: -------------------------------------------------------------------------------- 1 | # 4.5 Keylogger 2 | 3 | Category: Malware based 4 | Tags: Resource Development 5 | 6 | ### What is "Keylogger"? 7 | 8 | A keylogger is malware designed to capture keystrokes on a target's computer. This can be used to steal private keys by recording the keys used to unlock wallets or access other Web3 platforms. 9 | 10 | Keyloggers, also known as keystroke loggers or keystroke recorders, are types of malware that record every keystroke a user makes on a computer or mobile device. This can include sensitive information such as usernames, passwords, private keys, and other data that can be used to carry out cyber-attacks or steal cryptocurrency. 11 | 12 | Keyloggers can be either hardware or software-based, with software keyloggers being more common in modern times. They can be installed on a device via phishing attacks, malicious downloads, or other means and can run in the background without the user's knowledge. 13 | 14 | ### Example 15 | 16 | Sources have come forth alleging that the 2022 Lastpass hack event, whereby thousands if not millions of sensitive emails and passwords were “leaked” or compromised, occurred due to a keylogger hack targeting an employee. The company lost encrypted password vault data for all customers to a hacker secretly poking around LastPass’ systems for weeks. 17 | 18 | *“In Monday’s [update(Opens in a new window)](https://support.lastpass.com/help/incident-2-additional-details-of-the-attack), LastPass added that only four [DevOps](https://www.pcmag.com/encyclopedia/term/devops) engineers at the company possessed the necessary decryption keys through a “highly restricted set of shared folders.” However, the hacker circumvented the company’s security safeguards by serving malware to one of the DevOps engineers at their home.* 19 | 20 | *“This was accomplished by targeting the DevOps engineer’s home computer and exploiting a vulnerable third-party media software package, which enabled remote code execution capability and allowed the threat actor to implant keylogger malware,” LastPass said.”* 21 | 22 | ### Mitigation 23 | 24 | To mitigate the risk of keyloggers, users should follow basic cybersecurity practices and implement malware detection software, avoiding suspicious downloads and links and using two-factor authentication for all accounts. Users can use anti-malware software that includes keylogger detection and removal capabilities to protect their devices from this type of malware. 25 | 26 | Source: 27 | 28 | [https://www.pcmag.com/news/hacker-breached-lastpass-by-installing-keylogger-on-employees-home-computer](https://www.pcmag.com/news/hacker-breached-lastpass-by-installing-keylogger-on-employees-home-computer) -------------------------------------------------------------------------------- /oswar/resource_development/malware.md: -------------------------------------------------------------------------------- 1 | # 4. Acquiring/creating Malware 2 | 3 | Tags: Resource Development 4 | 5 | ### What is “Malware”? 6 | 7 | Malware within resource development involves acquiring malware to target the infrastructure in resource development. Various forms of malware exist, and some are purchased on the darkweb. The forms of malware in this section are traditional “Web2” malware & software. Here, it is malware which is dedicated to acquire resources like the private key. 8 | 9 | Malware is short for malicious software, which is designed to infiltrate and damage computer systems without the owner's consent or knowledge. Malware can take many forms, including viruses, worms, Trojans, ransomware, spyware, and adware. It can be spread through various means, including email attachments, infected software, compromised websites, or social engineering. 10 | 11 | ### Example 12 | 13 | One example of malware is ransomware. Ransomware is malware that encrypts the victim's data, rendering it inaccessible, and demands payment in exchange for the decryption key. This type of malware has been responsible for numerous high-profile attacks in recent years, including the WannaCry and Petya/NotPetya outbreaks. 14 | 15 | ### Mitigation 16 | 17 | Preventing malware attacks is critical for maintaining the security and integrity of computer systems. Here are some best practices for mitigating the risks associated with malware: 18 | 19 | 1. Keep software and operating systems up to date with the latest security patches and updates. 20 | 2. Install reputable antivirus and antimalware software and keep it updated. 21 | 3. Use strong and unique passwords for all accounts and enable two-factor authentication wherever possible. 22 | 4. Educate employees on recognizing and avoiding phishing scams and other social engineering tactics. 23 | 5. Regularly back up important data to an external source. 24 | 6. Monitor network traffic and system logs for signs of unusual activity. 25 | 7. Implement a least privilege policy to limit access to sensitive data and systems. 26 | 8. Conduct regular vulnerability assessments and penetration testing to identify and address security weaknesses. 27 | 28 | By following these best practices, individuals and organizations can significantly reduce their risk of falling victim to malware attacks. -------------------------------------------------------------------------------- /oswar/resource_development/network_profiling.md: -------------------------------------------------------------------------------- 1 | # 7. Network profiling 2 | 3 | Category: Analysis & profiling 4 | Tags: Resource Development 5 | 6 | ### What is Network profiling? 7 | 8 | Attackers can gather information on the topology of Web3 networks, identifying nodes, miners, and other network participants to identify potential targets for further attacks. In the context of web3 hacking, gathering information on the topology of Web3 networks is a reconnaissance technique that attackers use to map out the network infrastructure and identify potential targets for further attacks. By understanding the network structure, attackers can identify vulnerable nodes, miners, and other network participants to exploit. 9 | 10 | ### Example 11 | 12 | For example, an attacker might use network scanning tools to map out a blockchain network, identifying nodes that are publicly accessible and have weak security controls. They could then target those nodes with various attacks, such as denial-of-service attacks or exploits that exploit vulnerabilities in the node's software. 13 | 14 | Mitigation? 15 | 16 | It is not possible to completely prevent attackers from gathering information on the topology of Web3 networks, as the information is publicly available. However, “network administrators” can take steps to make it more difficult for attackers to identify vulnerable nodes, such as implementing stronger security controls and limiting the amount of information that is publicly available about network participants. -------------------------------------------------------------------------------- /oswar/resource_development/phishing_for_information.md: -------------------------------------------------------------------------------- 1 | # 1. Phishing for Information 2 | 3 | Category: Acquire Private Key 4 | Tags: Resource Development 5 | 6 | ### What is "Phishing for Information"? 7 | 8 | Phishing for information is the practice of tricking targets into revealing sensitive information through deceptive emails, social media messages, or other communications. In the context of Web3, phishing attacks can be used to steal private keys, wallet addresses, and other valuable resources that can be used to support an attack. Phishing is a common attack vector and can be used in different stages of an attack. 9 | 10 | In the context of resource development, phishing is primarily used to obtain more information rather than the actual private key, as the hacker may not be aware of which validator or person holds the private key. 11 | 12 | ### Example 13 | 14 | A real-world example of phishing for information in Web3 is the event where Coinbase employees received a phishing SMS on their phones. The phishing link sought to gather access to sensitive information from the Coinbase staff. 15 | 16 | > It all started on Sunday, February 5, 2023, when several Coinbase employees received text messages asking them to use the link sent by the attacker for an urgent login. While all recipients ignored the text, one employee logged in with their username and password. 17 | > 18 | > 19 | > With the help of the employee’s login credentials, the attacker attempted to access Coinbase’s internal network. However, since the company had enabled multi-factor authentication (MFA) for employees, the attacker could not bypass the security feature and could not proceed further even after several attempts. 20 | > 21 | > While the attacker was unsuccessful in accessing Coinbase’s system, a limited amount of data from the company’s directory was exposed, including names, email addresses, and phone numbers of a limited number of employees. 22 | > 23 | > **The Call** 24 | > 25 | > The second phase of the attack began with a phone call to the employee’s mobile phone, with the attacker claiming to be a member of Coinbase’s corporate Information Technology (IT) team. 26 | > 27 | > Trusting that the caller was a legitimate Coinbase IT staff member, the employee logged into their workstation and followed the attacker’s instructions. However, as the conversation progressed, the employee grew increasingly suspicious of the requests. 28 | > 29 | > Thankfully, the employee’s suspicions were enough to prevent damage. No funds were taken, and no customer information was accessed or viewed during the incident. 30 | > 31 | > Based on the attacker’s modus operandi, Coinbase believes the incident was not an isolated one and is linked to a series of cyberattacks that have taken place recently, including Twilio, DoorDash, Zendesk, Namecheap, and others. 32 | > 33 | 34 | Source: [https://www.hackread.com/coinbase-employees-sms-phishing-attack/](https://www.hackread.com/coinbase-employees-sms-phishing-attack/) 35 | 36 | ### Mitigation 37 | 38 | To protect against phishing attacks, Web3 users can take several measures, including: 39 | 40 | - **Using anti-phishing browser extensions:** Browser extensions, such as those for MetaMask and MyEtherWallet, can detect and block phishing websites and messages. 41 | - **Verifying URLs:** Users should verify the URL of the website they are visiting, especially when dealing with sensitive information. 42 | - **Avoiding clicking on suspicious links:** Users should avoid clicking on links in emails or messages from unknown senders or messages that seem too good to be true. 43 | - **Enabling two-factor authentication:** Two-factor authentication can add an extra layer of security to users' accounts and prevent attackers from gaining access even if they have the user's password. 44 | - **Educating users:** Educating users about the risks of phishing attacks and how to identify and avoid them can help prevent successful attacks. -------------------------------------------------------------------------------- /oswar/resource_development/resources_for_network-based_attacks.md: -------------------------------------------------------------------------------- 1 | # 8. Resources for network-based attacks 2 | 3 | Category: Infrastructure 4 | Tags: Resource Development 5 | 6 | ### What are "Resources for network-based attacks?" 7 | 8 | "Resources for network-based attacks" refer to the tools, techniques, and strategies that attackers can use to compromise the security of a network, such as a blockchain network. These resources may include software vulnerabilities, malware, social engineering tactics, brute force attacks, denial-of-service attacks, and other similar methods. 9 | 10 | The most commonly used consensus mechanisms within blockchain networks are Proof of Work (PoW) and Proof of Stake (PoS). For an attacker to take control of these distributed consensus networks, they must acquire enough computing power in the form of hash-rate or enough tokens within a token's circulating supply. 11 | 12 | ### Example 13 | 14 | An example of an attack that exploits network vulnerabilities is the 51% attack on a blockchain network. In this type of attack, an attacker needs to gain control of the majority of the network's computing power or tokens, enabling them to manipulate the blockchain's ledger and transactions. While any PoS or PoW-based network is theoretically vulnerable to such an attack, executing on well-established blockchains like Ethereum or Bitcoin is extremely difficult. 15 | 16 | ### Mitigation 17 | 18 | Blockchain networks need to be as decentralized as possible to prevent such attacks. The issue arises with the introduction of decentralization and decentralized consensus. Various networks have different degrees of percentage when it comes to being able to take over the network. Some have it as high as 2/3, meaning 66%. If a network has been 51% attacked, there is not much to do to prevent it. It will often just result in a network fork. There will be two chains, and then the community needs to decide which “correct” chain is. -------------------------------------------------------------------------------- /oswar/resource_development/spear_phishing.md: -------------------------------------------------------------------------------- 1 | # 5. Spear Phishing 2 | 3 | Category: Acquire Private Key 4 | Tags: Resource Development 5 | 6 | ### What is "Spear Phishing"? 7 | 8 | Spear phishing is a type of phishing attack that is targeted at a specific individual or group of individuals rather than a broader audience. In the context of Web3, blockchains, and crypto, spear phishing can be used to steal private keys, wallet addresses, and other resources that can be used to support an attack. Spear phishing attacks typically involve crafting convincing emails or messages that appear to come from a trusted source, such as a colleague, friend, or family member. The emails may contain requests for sensitive information, or they may include links to malicious websites or downloads that can be used to steal information or gain access to a target's computer or network. 9 | 10 | ### Example: 11 | 12 | A common example of a spear phishing attack in the web3 context is when an attacker sends a personalized email to a target claiming to be a member of a blockchain project or an investor in a cryptocurrency. The email may contain information specific to the target, such as their name or recent activity on the blockchain. The email may also include a request for the target to click on a link or download a file that appears to be legitimate but is malicious. Once the target clicks on the link or downloads the file, the attacker can use it to steal private keys, wallet addresses, and other sensitive information. 13 | 14 | Another example of spear phishing in the web3 context is when an attacker creates a fake social media account and contacts a target with a message that appears to come from a friend or colleague. The message may contain a link to a malicious website or download that can be used to steal sensitive information. 15 | 16 | ### Mitigation: 17 | 18 | To mitigate spear phishing attacks, web3 users should be cautious when receiving emails or messages from unknown or untrusted sources. Users should verify the authenticity of any requests for sensitive information before responding or providing any information. It is also important to use strong passwords and two-factor authentication to protect accounts and wallets from unauthorized access. 19 | 20 | Web3 users should also be aware of the latest phishing techniques. They should keep their software and systems up-to-date with the latest security patches to prevent attackers from exploiting known vulnerabilities. 21 | 22 | --- 23 | 24 | This involves targeting specific individuals or groups with personalized and convincing methods of contact. In the context of Web3, blockchains and crypto, spear phishing can be used to steal private keys, wallet addresses, and other resources that can be used to support an attack. 25 | 26 | Spear phishing is a type of phishing attack that is targeted at a specific individual or group of individuals, rather than a broader audience. Unlike regular phishing attacks that may be sent out to a large number of people in the hopes of tricking a few of them into revealing sensitive information, spear phishing attacks are highly personalized and often use information that is specific to the target to increase the chances of success. 27 | 28 | Spear phishing attacks typically involve crafting convincing emails or messages that appear to come from a trusted source, such as a colleague, friend, or family member. The emails may contain requests for sensitive information, or they may include links to malicious websites or downloads that can be used to steal information or gain access to a target's computer or network. 29 | 30 | Spear phishing attacks can be highly effective because they often appear to be legitimate and come from a trusted source. They can be used to steal sensitive information such as usernames and passwords, private keys, and other valuable resources that can be used to carry out cyber attacks or steal cryptocurrency. -------------------------------------------------------------------------------- /oswar_og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyVers-AI/oswar/599224324553359a86a30c90d171a9bc265ca382/oswar_og.png --------------------------------------------------------------------------------