forked from open-education-hub/essentials-security
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binary-analysis: Add session content
Add content related to binary-analysis. Signed-off-by: Mihnea Firoiu <[email protected]>
- Loading branch information
1 parent
2371bd7
commit bfacda9
Showing
29 changed files
with
97 additions
and
96 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
chapters/binary-introduction/binary-analysis/drills/easy-to-spot/sol/README.md
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
chapters/binary-introduction/binary-analysis/drills/tasks/easy-to-spot/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Easy to Spot | ||
|
||
It's an easy challenge. | ||
Really. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/static-analysis.md) reading material. |
3 changes: 3 additions & 0 deletions
3
...inary-introduction/binary-analysis/drills/tasks/easy-to-spot/solution/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Easy to Spot Solution | ||
|
||
The easiest way to find the flag is by using the `strings` tool, as the flag is stored in plaintext in a variable. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
chapters/binary-introduction/binary-analysis/drills/tasks/ghidra-killer/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Ghidra Killer | ||
|
||
Some people just hate the people that use decompilers. | ||
One of those people left you a binary, to investigate. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/dynamic-analysis.md) reading material. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...nary-introduction/binary-analysis/drills/tasks/packaging-is-important/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Packaging is Important | ||
|
||
Someone delivered you a mysterious package. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/static-analysis.md) reading material. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
chapters/binary-introduction/binary-analysis/drills/tasks/spaghetti/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Spaghetti | ||
|
||
Someone felt like cooking today. | ||
Can you find the flag? | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/static-analysis.md) reading material. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
chapters/binary-introduction/binary-analysis/reading/dynamic-analysis.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Dynamic Analysis | ||
|
||
Dynamic analysis means observing the behaviour of the binary, while it is running. | ||
This is performed by tracing or sandboxing. | ||
|
||
Tracing is the process during which various checkpoints are placed in the code, that send alerts when the execution has reached them. | ||
Generally, the context (registers, stack, variables) is also displayed. | ||
|
||
Sandboxing is a more complex process, in which you isolate a binary in a virtual machine (usually), run it and observe the changes made on the system: modified files, network traffic, etc. | ||
|
||
Today, we are going to explore tracing. | ||
|
||
## strace | ||
|
||
`strace` shows system calls performed by a binary application. | ||
That means opening any kind of file, reading and writing into files, `mprotect`s and other things. | ||
It is useful to find out if the program does any changes to the system itself, or if it writes in some files. | ||
|
||
## ltrace | ||
|
||
`ltrace` shows calls to dynamic library functions, along with system calls. | ||
It is similar to `strace`. | ||
|
||
## gdb | ||
|
||
GDB is the most powerful dynamic analysis tool available to the regular user. | ||
It allows executing the code instruction by instruction, inspecting memory areas, changing memory areas, jumping to other pieces of code, that weren't executed normally. | ||
GDB is best used when the user has knowledge about assembly language, which will be presented in the last 2 sessions. | ||
For this session, GDB isn't required. |
9 changes: 9 additions & 0 deletions
9
chapters/binary-introduction/binary-analysis/reading/introduction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Introduction | ||
|
||
Today's session aims to give you some tools to analyze a binary, in order to determine what that binary does and if it can hurt your system. | ||
|
||
## Reminders | ||
|
||
- code can't just be run; | ||
it needs to be compiled and linked, becoming an executable | ||
- the value of most symbols is placed in the binary file, in sections, and can be observed without actually running the executable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
chapters/binary-introduction/binary-analysis/reading/summary.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Summary | ||
|
||
- Static analysis is the investigation of a binary file without actually running it. | ||
It means disassembling, decompiling the executable, or directly reading the actual contents of the executable. | ||
- Static analysis is performed with tools like `strings`, `file`, `nm`, `Ghidra`. | ||
- Dynamic analysis the investigation of an executable while it is running | ||
- Dynamic analysis is performed using tools like `strace`, `ltrace`, `gdb`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters