Blockchain and Crypto-Currencies
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Basic Concepts
- Smart Contracts are defined as programs that execute on a blockchain when certain conditions are met, automating agreement executions without intermediaries.
- Decentralized Applications (dApps) build upon smart contracts, featuring a user-friendly front-end and a transparent, auditable back-end.
- Tokens & Coins differentiate where coins serve as digital money, while tokens represent value or ownership in specific contexts.
- Utility Tokens grant access to services, and Security Tokens signify asset ownership.
- DeFi stands for Decentralized Finance, offering financial services without central authorities.
- DEX and DAOs refer to Decentralized Exchange Platforms and Decentralized Autonomous Organizations, respectively.
Consensus Mechanisms
Consensus mechanisms ensure secure and agreed transaction validations on the blockchain:
- Proof of Work (PoW) relies on computational power for transaction verification.
- Proof of Stake (PoS) demands validators to hold a certain amount of tokens, reducing energy consumption compared to PoW.
Bitcoin Essentials
Transactions
Bitcoin transactions involve transferring funds between addresses. Transactions are validated through digital signatures, ensuring only the owner of the private key can initiate transfers.
Key Components:
- Multisignature Transactions require multiple signatures to authorize a transaction.
- Transactions consist of inputs (source of funds), outputs (destination), fees (paid to miners), and scripts (transaction rules).
Lightning Network
Aims to enhance Bitcoinโs scalability by allowing multiple transactions within a channel, only broadcasting the final state to the blockchain.
Bitcoin Privacy Concerns
Privacy attacks, such as Common Input Ownership and UTXO Change Address Detection, exploit transaction patterns. Strategies like Mixers and CoinJoin improve anonymity by obscuring transaction links between users.
Acquiring Bitcoins Anonymously
Methods include cash trades, mining, and using mixers. CoinJoin mixes multiple transactions to complicate traceability, while PayJoin disguises CoinJoins as regular transactions for heightened privacy.
Bitcoin Privacy Atacks
Summary of Bitcoin Privacy Attacks
In the world of Bitcoin, the privacy of transactions and the anonymity of users are often subjects of concern. Hereโs a simplified overview of several common methods through which attackers can compromise Bitcoin privacy.
Common Input Ownership Assumption
It is generally rare for inputs from different users to be combined in a single transaction due to the complexity involved. Thus, two input addresses in the same transaction are often assumed to belong to the same owner.
UTXO Change Address Detection
A UTXO, or Unspent Transaction Output, must be entirely spent in a transaction. If only a part of it is sent to another address, the remainder goes to a new change address. Observers can assume this new address belongs to the sender, compromising privacy.
Example
To mitigate this, mixing services or using multiple addresses can help obscure ownership.
Social Networks & Forums Exposure
Users sometimes share their Bitcoin addresses online, making it easy to link the address to its owner.
Transaction Graph Analysis
Transactions can be visualized as graphs, revealing potential connections between users based on the flow of funds.
Unnecessary Input Heuristic (Optimal Change Heuristic)
This heuristic is based on analyzing transactions with multiple inputs and outputs to guess which output is the change returning to the sender.
Example
2 btc --> 4 btc
3 btc 1 btc
์ ๋ ฅ(์ ๋ ฅ UTXO)์ ๋ ์ถ๊ฐํด ๊ฑฐ์ค๋ฆ๋ ์ถ๋ ฅ์ด ์ด๋ค ๋จ์ผ ์ ๋ ฅ๋ณด๋ค ์ปค์ง๋ฉด, ํด๋ฆฌ์คํฑ์ ํผ๋์ํฌ ์ ์๋ค.
๊ฐ์ ๋ ์ฃผ์ ์ฌ์ฌ์ฉ
๊ณต๊ฒฉ์๋ ์์ก์ ์ด์ ์ ์ฌ์ฉ๋ ์ฃผ์๋ก ๋ณด๋ด ์์ ์๊ฐ ์ดํ ํธ๋์ญ์ ์์ ์ด๋ฅผ ๋ค๋ฅธ ์ ๋ ฅ๋ค๊ณผ ๊ฒฐํฉํ๋๋ก ์ ๋ํ ์ ์์ผ๋ฉฐ, ์ด๋ก์จ ์ฃผ์๋ค์ ์๋ก ์ฐ๊ฒฐ์ํค๋ ค ํ๋ค.
์ฌ๋ฐ๋ฅธ ์ง๊ฐ ๋์
์ง๊ฐ์ ์ด๋ฏธ ์ฌ์ฉ๋ ๋น ์ฃผ์๋ก ๋ฐ์ ์ฝ์ธ์ ์ฌ์ฉํ์ง ์์์ผ ํ๋ฉฐ, ์ด๋ ํ๋ผ์ด๋ฒ์ leak๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํจ์ด๋ค.
๊ธฐํ ๋ธ๋ก์ฒด์ธ ๋ถ์ ๊ธฐ๋ฒ
- ์ ํํ ๊ฒฐ์ ๊ธ์ก: ๊ฑฐ์ค๋ฆ๋์ด ์๋ ํธ๋์ญ์ ์ ๋์ผ ์ฌ์ฉ์๊ฐ ์์ ํ ๋ ์ฃผ์ ๊ฐ์ ๊ฑฐ๋์ผ ๊ฐ๋ฅ์ฑ์ด ๋๋ค.
- ๋ฐ์ฌ๋ฆผ๋ ๊ธ์ก: ๊ฑฐ๋์์ ๋ฐ์ฌ๋ฆผ๋ ๊ธ์ก์ ๊ฒฐ์ ์ผ ๊ฐ๋ฅ์ฑ์ด ๋๊ณ , ๋ฐ์ฌ๋ฆผ๋์ง ์์ ์ถ๋ ฅ์ด ๊ฑฐ์ค๋ฆ๋์ผ ๊ฐ๋ฅ์ฑ์ด ๋๋ค.
- ์ง๊ฐ ์ง๋ฌธํ: ์๋ก ๋ค๋ฅธ ์ง๊ฐ์ ๊ณ ์ ํ ํธ๋์ญ์ ์์ฑ ํจํด์ ๊ฐ์ง๋ฉฐ, ๋ถ์๊ฐ๋ ์ด๋ฅผ ํตํด ์ฌ์ฉ๋ ์ํํธ์จ์ด ๋ฐ ์ ์ฌ์ ์ธ change ์ฃผ์๋ฅผ ์๋ณํ ์ ์๋ค.
- ๊ธ์ก ๋ฐ ์๊ฐ ์๊ด๊ด๊ณ: ๊ฑฐ๋ ์๊ฐ์ด๋ ๊ธ์ก์ ๊ณต๊ฐํ๋ฉด ๊ฑฐ๋ ์ถ์ ์ด ์ฌ์์ง๋ค.
ํธ๋ํฝ ๋ถ์
๋คํธ์ํฌ ํธ๋ํฝ์ ๋ชจ๋ํฐ๋งํจ์ผ๋ก์จ ๊ณต๊ฒฉ์๋ ํธ๋์ญ์ ์ด๋ ๋ธ๋ก์ IP ์ฃผ์์ ์ฐ๊ฒฐ์์ผ ์ฌ์ฉ์ ํ๋ผ์ด๋ฒ์๋ฅผ ์์์ํฌ ์ ์๋ค. ํนํ ๋ง์ ์์ Bitcoin ๋ ธ๋๋ฅผ ์ด์ํ๋ ์ฃผ์ฒด๋ ํธ๋์ญ์ ์ ๊ฐ์ํ ๋ฅ๋ ฅ์ด ํฅ์๋๋ค.
More
ํฌ๊ด์ ์ธ ํ๋ผ์ด๋ฒ์ ๊ณต๊ฒฉ ๋ฐ ๋ฐฉ์ด ๋ชฉ๋ก์ Bitcoin Privacy on Bitcoin Wiki๋ฅผ ์ฐธ์กฐํ๋ผ.
์ต๋ช Bitcoin ๊ฑฐ๋
์ต๋ช ์ผ๋ก Bitcoin์ ์ป๋ ๋ฐฉ๋ฒ
- Cash Transactions: ํ๊ธ์ ํตํด bitcoin์ ์ทจ๋.
- Cash Alternatives: ๊ธฐํํธ ์นด๋๋ฅผ ๊ตฌ๋งคํด ์จ๋ผ์ธ์์ bitcoin์ผ๋ก ๊ตํ.
- ์ฑ๊ตด: ํผ์ ์ฑ๊ตดํ ๋๊ฐ ๊ฐ์ฅ ํ๋ผ์ด๋นํ๊ฒ bitcoin์ ์ป๋ ๋ฐฉ๋ฒ์ด๋ค. ๋ง์ด๋ ํ์ ์ฑ๊ตด์์ IP ์ฃผ์๋ฅผ ์ ์ ์๋ค. Mining Pools Information
- Theft: ์ด๋ก ์ ์ผ๋ก๋ ๋นํธ์ฝ์ธ์ ํ์น๋ ๊ฒ์ด ๋ ๋ค๋ฅธ ์ต๋ช ํ๋ ๋ฐฉ๋ฒ์ด ๋ ์ ์์ผ๋, ๋ถ๋ฒ์ด๋ฉฐ ๊ถ์ฅ๋์ง ์๋๋ค.
๋ฏน์ฑ ์๋น์ค
๋ฏน์ฑ ์๋น์ค๋ฅผ ์ด์ฉํ๋ฉด ์ฌ์ฉ์๋ ๋นํธ์ฝ์ธ์ ๋ณด๋ด๊ณ ๋ค๋ฅธ ๋นํธ์ฝ์ธ์ ๋ฐ์ ์๋ ์์ ์๋ฅผ ์ถ์ ํ๊ธฐ ์ด๋ ต๊ฒ ๋ง๋ค ์ ์๋ค. ๋ค๋ง ์๋น์ค๊ฐ ๋ก๊ทธ๋ฅผ ๋ณด๊ดํ์ง ์๊ณ ์ค์ ๋ก ๋นํธ์ฝ์ธ์ ๋ฐํํ ๊ฒ์ด๋ผ๋ ์ ๋ขฐ๊ฐ ํ์ํ๋ค. ๋์์ผ๋ก Bitcoin ์นด์ง๋ ธ ๋ฑ์ด ์๋ค.
CoinJoin
CoinJoin๋ ์ฌ๋ฌ ์ฌ์ฉ์์ ํธ๋์ญ์ ์ ํ๋๋ก ํฉ์ณ ์ ๋ ฅ๊ณผ ์ถ๋ ฅ์ ๋งค์นญํ๋ ค๋ ์๋๋ฅผ ๋ณต์กํ๊ฒ ๋ง๋ ๋ค. ๊ทธ๋ผ์๋ ๋ถ๊ตฌํ๊ณ ์ ๋ ฅ ๋ฐ ์ถ๋ ฅ ํฌ๊ธฐ๊ฐ ๊ณ ์ ํ ํธ๋์ญ์ ์ ์ฌ์ ํ ์ถ์ ๋ ๊ฐ๋ฅ์ฑ์ด ์๋ค.
์์ ํธ๋์ญ์
(์ฌ์ฉ๋์ ๊ฐ๋ฅ์ฑ ์์): 402d3e1df685d1fdf82f36b220079c1bf44db227df2d676625ebcbee3f6cb22a ๋ฐ 85378815f6ee170aa8c26694ee2df42b99cff7fa9357f073c1192fff1f540238.
์์ธํ ์ ๋ณด๋ CoinJoin์ ์ฐธ๊ณ ํ๋ผ. Ethereum ์์ ์ ์ฌ ์๋น์ค๋ Tornado Cash๋ก, ์ฑ๊ตด์๋ค๋ก๋ถํฐ์ ์๊ธ์ผ๋ก ํธ๋์ญ์ ์ ์ต๋ช ํํ๋ค.
PayJoin
CoinJoin์ ๋ณํ์ธ PayJoin(๋๋ P2EP)์ ๋ ๋น์ฌ์(์: ๊ณ ๊ฐ๊ณผ ์์ธ) ์ฌ์ด์ ํธ๋์ญ์ ์ ์ผ๋ฐ ํธ๋์ญ์ ์ฒ๋ผ ์์ฅํ์ฌ CoinJoin์ ๋๋ฑํ ์ถ๋ ฅ ํน์ง์ ๋ณด์ด์ง ์๊ฒ ํ๋ค. ์ด๋ ํ์ง๊ฐ ๊ทน๋๋ก ์ด๋ ต๊ฒ ๋ง๋ค๋ฉฐ, ๊ฑฐ๋ ๊ฐ์ ์ฃผ์ฒด๋ค์ด ์ฌ์ฉํ๋ common-input-ownership heuristic์ ๋ฌด๋ ฅํํ ์๋ ์๋ค.
2 btc --> 3 btc
5 btc 4 btc
Transactions like the above could be PayJoin, enhancing privacy while remaining indistinguishable from standard bitcoin transactions.
The utilization of PayJoin could significantly disrupt traditional surveillance methods, making it a promising development in the pursuit of transactional privacy.
Best Practices for Privacy in Cryptocurrencies
Wallet Synchronization Techniques
To maintain privacy and security, synchronizing wallets with the blockchain is crucial. Two methods stand out:
- Full node: By downloading the entire blockchain, a full node ensures maximum privacy. All transactions ever made are stored locally, making it impossible for adversaries to identify which transactions or addresses the user is interested in.
- Client-side block filtering: This method involves creating filters for every block in the blockchain, allowing wallets to identify relevant transactions without exposing specific interests to network observers. Lightweight wallets download these filters, only fetching full blocks when a match with the userโs addresses is found.
Utilizing Tor for Anonymity
Given that Bitcoin operates on a peer-to-peer network, using Tor is recommended to mask your IP address, enhancing privacy when interacting with the network.
Preventing Address Reuse
To safeguard privacy, itโs vital to use a new address for every transaction. Reusing addresses can compromise privacy by linking transactions to the same entity. Modern wallets discourage address reuse through their design.
Strategies for Transaction Privacy
- Multiple transactions: Splitting a payment into several transactions can obscure the transaction amount, thwarting privacy attacks.
- Change avoidance: Opting for transactions that donโt require change outputs enhances privacy by disrupting change detection methods.
- Multiple change outputs: If avoiding change isnโt feasible, generating multiple change outputs can still improve privacy.
Monero: A Beacon of Anonymity
Monero addresses the need for absolute anonymity in digital transactions, setting a high standard for privacy.
Ethereum: Gas and Transactions
Understanding Gas
Gas measures the computational effort needed to execute operations on Ethereum, priced in gwei. For example, a transaction costing 2,310,000 gwei (or 0.00231 ETH) involves a gas limit and a base fee, with a tip to incentivize miners. Users can set a max fee to ensure they donโt overpay, with the excess refunded.
Executing Transactions
Transactions in Ethereum involve a sender and a recipient, which can be either user or smart contract addresses. They require a fee and must be mined. Essential information in a transaction includes the recipient, senderโs signature, value, optional data, gas limit, and fees. Notably, the senderโs address is deduced from the signature, eliminating the need for it in the transaction data.
These practices and mechanisms are foundational for anyone looking to engage with cryptocurrencies while prioritizing privacy and security.
Value-Centric Web3 Red Teaming
- Inventory value-bearing components (signers, oracles, bridges, automation) to understand who can move funds and how.
- Map each component to relevant MITRE AADAPT tactics to expose privilege escalation paths.
- Rehearse flash-loan/oracle/credential/cross-chain attack chains to validate impact and document exploitable preconditions.
Value Centric Web3 Red Teaming
Web3 Signing Workflow Compromise
- Supply-chain tampering of wallet UIs can mutate EIP-712 payloads right before signing, harvesting valid signatures for delegatecall-based proxy takeovers (e.g., slot-0 overwrite of Safe masterCopy).
Web3 Signing Workflow Compromise Safe Delegatecall Proxy Takeover
Smart Contract Security
- Mutation testing to find blind spots in test suites:
References
- https://en.wikipedia.org/wiki/Proof_of_stake
- https://www.mycryptopedia.com/public-key-private-key-explained/
- https://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions
- https://ethereum.org/en/developers/docs/transactions/
- https://ethereum.org/en/developers/docs/gas/
- https://en.bitcoin.it/wiki/Privacy
DeFi/AMM Exploitation
If you are researching practical exploitation of DEXes and AMMs (Uniswap v4 hooks, rounding/precision abuse, flashโloan amplified thresholdโcrossing swaps), check:
For multi-asset weighted pools that cache virtual balances and can be poisoned when supply == 0, study:
Defi Amm Virtual Balance Cache Exploitation
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


