Skip to content

Commit a02d442

Browse files
author
swaroop
committed
Added few more exercises
1 parent 02e5c75 commit a02d442

File tree

45 files changed

+6508
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6508
-203
lines changed

iGoat-Swift/iGoat-Objc-Bridging-Header.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
#import "UIImage+animatedGIF.h"
1010
#import "SVProgressHUD.h"
1111
#import <CommonCrypto/CommonCrypto.h>
12+
#import <sqlite3.h>
13+
14+
char *do_it(void);

iGoat-Swift/iGoat-Swift.xcodeproj/project.pbxproj

Lines changed: 375 additions & 113 deletions
Large diffs are not rendered by default.

iGoat-Swift/iGoat-Swift/Resources/Assets.plist

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -72,76 +72,6 @@
7272
</dict>
7373
</array>
7474
</dict>
75-
<key>Sample Test</key>
76-
<dict>
77-
<key>description</key>
78-
<string>This exercise category contains exercises related to reverse engineering a mobile app&apos;s binary code. On its own, reverse engineering an app leads to a number of valuable things for a hacker. First, it will give the hacker a solid blueprint of the app and reveal a great deal of information about the underlying architecture, design, and implementation. This can lead to things like counterfeiting or stealing of code. As a springboard, the hacker can then exploit this knowledge to conduct other types of attacks. For instance, the hacker may extract infrastructure passwords to conduct infrastructure attacks against backend systems. The hacker may leverage this knowledge to modify the app or its runtime behavior. These exercises show you how to raise the bar and make it much more painful and difficult for the hacker to successfully extract anything useful from the binary.</string>
79-
<key>exercises</key>
80-
<array>
81-
<dict>
82-
<key>creditsFile</key>
83-
<string>KRvWAssociates.html</string>
84-
<key>description</key>
85-
<string>In this exercise, we are trying to extract a secret piece of information embedded within a string located within the app&apos;s binary. Ideally, you should avoid relying upon sensitive strings embedded within your binary. However, that is not always realistic. Offline availability requirements or system architectures typically drive the need for reliance upon embedded strings. In some scenarios, it is not possible to avoid placing sensitive strings within your string table. However, there are things you can do to make it much more difficult to exploit these strings...
86-
87-
Your first goal is to perform a string analysis of the compiled binary and answer the riddle posed by this exercise.
88-
89-
Your second goal is to alter the mobile app in such a way that static analysis will not easily reveal the answer to the riddle.
90-
</string>
91-
<key>hints</key>
92-
<array>
93-
<string>To extract useful string information from a binary, a hacker will follow a well-established methodology. First, the hacker will download the app from the iTunes store and decrypt it within a jailbroken environment using a free tool like &lt;i&gt;Clutch&lt;/i&gt;.&lt;br/&gt;&lt;br/&gt;
94-
95-
To see a demo of how to bypass iTunes code encryption, click &lt;a href=&quot;http://m.youtube.com/watch?v=nOFXsR4-2AQ&quot;&gt;here&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;
96-
97-
Normally, you must start a string analysis by breaking through iTunes code encryption to look at the underlying string table. However, you are running this app within a development environment. Hence, you cannot download the iTunes version of the app which would include this easily breakable protection. You can safely ignore the first step of bypassing iTunes code encryption through the use of a tool like &lt;i&gt;Clutch&lt;/i&gt; on your binary.
98-
99-
</string>
100-
<string>The heart of every iPhone mobile app lies within its core binary file. The file contains ARM instructions that will be executed by iOS. When you download the app from the iTunes store, your phone receives an IPA file. This is an archive that contains an application bundle (APP file) as well as other files meant for iTunes management of your app.&lt;br/&gt;&lt;br/&gt;
101-
102-
Within the Xcode environment, you can find the APP file within the &lt;i&gt;Products&lt;/i&gt; directory of the iGoat project. The particular subdirectory will dependend upon which target you are building against. If you are running the app within an iOS emulator, you can find the APP file within the filepath &lt;i&gt;~/Library/Application\ Support/iPhone\ Simulator&lt;/i&gt;.
103-
</string>
104-
<string>The application bundle contains the raw binary you will want to analyze. The binary typically has the same name as the project. In this case, the name of the raw binary is the filename &lt;i&gt;iGoat&lt;/i&gt;
105-
</string>
106-
<string>A hacker will use static analysis tools (&lt;i&gt;IDA Pro&lt;/i&gt;; &lt;i&gt;Hopper&lt;/i&gt;; &lt;i&gt;strings&lt;/i&gt;)to inspect the unencrypted binary&apos;s string table. To learn how to perform basic static analysis, click &lt;a href=&quot;http://m.youtube.com/watch?v=GvqnJmTb9HU&quot;&gt;here&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;
107-
108-
If you like the idea of using a simple command line tool instead, check out &lt;i&gt;strings&lt;/i&gt;.
109-
</string>
110-
<string>A hacker will typically pipe the output from the &lt;i&gt;strings&lt;/i&gt; command line tool to another tool like &lt;i&gt;grep&lt;/i&gt; to search for strings matching a particular pattern.
111-
</string>
112-
<string>There are many simple, easy things you can do to your original code to trick casual hackers from identifying sensitive strings contained within your binary string table. You can tweak the algorithm behind the code that retrieves the sensitive string to ensure that the original string is never stored in plaintext and easily accessible to the hacker.&lt;br/&gt;&lt;br/&gt;
113-
114-
Which type of encryption / encoding algorithms are available to you? What do you need to worry about with each type?
115-
</string>
116-
</array>
117-
<key>initialViewController</key>
118-
<string>SampleDemoVC</string>
119-
<key>name</key>
120-
<string>Sample Demo</string>
121-
<key>solution</key>
122-
<string>There are two key goals of this exercise.
123-
124-
First, you must answer the riddle posed to you by the application. You might be tempted to just look at the source code and get the answer. However, a hacker will not have the luxury of doing so as they will not have access to the original source code. They will only have access to what they can download off the iTunes store. The answer is embedded within the app&apos;s binary string table.
125-
126-
To get the answer, a hacker must perform binary string analysis and inspect its string table. The string table contains any hardcoded strings used by the code throughout its execution. Hardcoded strings reveal all sorts of useful tidbits of information. A hacker can use a string table to cross-reference and locate sensitive algorithms within the binary. There are many studies of apps in the wild that show the prevalence of hardcoded usernames and passwords to backend systesm.
127-
128-
Use the command-line tool &lt;i&gt;strings&lt;/i&gt; against the core binary file iGoat and pipe the output to &lt;i&gt;grep&lt;/i&gt; to search for the answer to the riddle.
129-
130-
&lt;i&gt;strings iGoat | grep riddle&lt;/i&gt;
131-
132-
The second goal is to make the app immune to this type of binary attack. To achieve this goal, there are a number of different techniques available. You could store an encrypted version of the string within the string table and decrypt it at runtime. After decryption, perform the string comparison to determine if the answer is correct. In taking this approach, static analysis will no longer yield a useful result. The attacker will be forced to move into the more expensive proposition of performing dynamic analysis to deduce the answer to the riddle. There are a whole other set of deterrents related to preventing or frustrating dynamic analsyis.
133-
134-
You could also transform the representation of the string into something else (like an array of bytes) that would take it completely outside of the string table. You would be surprised how often this simple transformation will deter a hacker from going further...
135-
136-
&lt;H1&gt;External References&lt;/H1&gt;
137-
&lt;OL&gt;
138-
&lt;LI&gt;OWASP Technical Risks of Reverse Engineering and Unauthorized Code Modification - &lt;i&gt;&lt;a href=&quot;https://www.owasp.org/index.php/Technical_Risks_of_Reverse_Engineering_and_Unauthorized_Code_Modification#Exposed_String_Tables&quot;&gt;Exposed String Tables&lt;/a&gt;&lt;/i&gt;&lt;/LI&gt;
139-
&lt;LI&gt;OWASP Mobile Top Ten 2014 - &lt;i&gt;&lt;a href=&quot;https://www.owasp.org/index.php/Mobile_Top_10_2014-M10&quot;&gt;M10&lt;/a&gt;&lt;/i&gt;&lt;/LI&gt;
140-
&lt;/OL&gt;
141-
</string>
142-
</dict>
143-
</array>
144-
</dict>
14575
<key>Tampering</key>
14676
<dict>
14777
<key>description</key>
@@ -254,7 +184,7 @@
254184
<string>If you received a message telling you that your credentials were compromised, you&apos;ve finished the first part.</string>
255185
</array>
256186
<key>initialViewController</key>
257-
<string>RemoteAuthenticationExerciseController</string>
187+
<string>RemoteAuthenticationExerciseVC</string>
258188
<key>name</key>
259189
<string>Remote Authentication</string>
260190
<key>solution</key>
@@ -637,7 +567,7 @@ Pinning is the process of a mobile app verifying an SSL server&apos;s identity t
637567
all the data in the database.</string>
638568
</array>
639569
<key>initialViewController</key>
640-
<string>SQLInjectionExerciseController</string>
570+
<string>SQLInjectionExerciseVC</string>
641571
<key>name</key>
642572
<string>SQL Injection</string>
643573
<key>solution</key>
@@ -663,7 +593,7 @@ Pinning is the process of a mobile app verifying an SSL server&apos;s identity t
663593
<string>Can you try most common XSS payload?</string>
664594
</array>
665595
<key>initialViewController</key>
666-
<string>CrossSiteScriptingExerciseViewController</string>
596+
<string>CrossSiteScriptingExerciseVC</string>
667597
<key>name</key>
668598
<string>Cross Site Scripting</string>
669599
<key>solution</key>
@@ -877,7 +807,7 @@ Pinning is the process of a mobile app verifying an SSL server&apos;s identity t
877807
<string>Can you identify hard coded encryption key in code?</string>
878808
</array>
879809
<key>initialViewController</key>
880-
<string>BrokenCryptographyExerciseViewController</string>
810+
<string>BrokenCryptographyExerciseVC</string>
881811
<key>name</key>
882812
<string>Hardcoded Keys</string>
883813
<key>solution</key>
@@ -893,7 +823,7 @@ Pinning is the process of a mobile app verifying an SSL server&apos;s identity t
893823
<string>Look into one of side channel data leakage.</string>
894824
</array>
895825
<key>initialViewController</key>
896-
<string>RandomKeyGenerationExerciseViewController</string>
826+
<string>RandomKeyGenerationExerciseVC</string>
897827
<key>name</key>
898828
<string>Random Key Generation</string>
899829
<key>solution</key>

iGoat-Swift/iGoat-Swift/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
"scale" : "3x"
1212
},
1313
{
14-
"idiom" : "iphone",
1514
"size" : "29x29",
15+
"idiom" : "iphone",
16+
"filename" : "igoat_icon_58x58.png",
1617
"scale" : "2x"
1718
},
1819
{
19-
"idiom" : "iphone",
2020
"size" : "29x29",
21+
"idiom" : "iphone",
22+
"filename" : "igoat_icon_1_87x87.png",
2123
"scale" : "3x"
2224
},
2325
{
@@ -31,13 +33,15 @@
3133
"scale" : "3x"
3234
},
3335
{
34-
"idiom" : "iphone",
3536
"size" : "60x60",
37+
"idiom" : "iphone",
38+
"filename" : "igoat_icon_2_120x120.png",
3639
"scale" : "2x"
3740
},
3841
{
39-
"idiom" : "iphone",
4042
"size" : "60x60",
43+
"idiom" : "iphone",
44+
"filename" : "igoat_icon_3_180x180.png",
4145
"scale" : "3x"
4246
},
4347
{
5.57 KB
Loading
8.17 KB
Loading
14.9 KB
Loading
3.22 KB
Loading

0 commit comments

Comments
 (0)