Skip to content

Commit ee6ad2a

Browse files
committed
Merge branch 'release/0.2.4'
2 parents b181eb7 + 2a1942d commit ee6ad2a

9 files changed

Lines changed: 44 additions & 30 deletions

File tree

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
DROIDGROUND_BASE_PATH= # If you want to host the webapp on a subpath
12
DROIDGROUND_APP_PACKAGE_NAME=com.droidground.hiddenactivity
23
DROIDGROUND_ADB_HOST=localhost
34
DROIDGROUND_ADB_PORT=5037
@@ -19,4 +20,5 @@ DROIDGROUND_START_ACTIVITY_DISABLED=false # Feature enabled by default if not se
1920
DROIDGROUND_START_RECEIVER_DISABLED=false # Feature enabled by default if not set otherwise
2021
DROIDGROUND_START_SERVICE_DISABLED=false # Feature enabled by default if not set otherwise
2122
DROIDGROUND_TERMINAL_DISABLED=false # Feature enabled by default if not set otherwise
23+
DROIDGROUND_RESET_DISABLED=false # Feature enabled by default if not set otherwise
2224
DROIDGROUND_EXPLOIT_APP_DURATION=10 # The time (in seconds) the exploit app will be active before the target app is restarted. This field makes sense only if the App Manager is enabled. Default value is 10

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The `.env.sample` file in the root directory is a good starting point. This is t
7777

7878
| Variable | Description | Default |
7979
| ------------------------------------- | ---------------------------------------------------- | ----------- |
80+
| `DROIDGROUND_BASE_PATH` | Path of the webapp (useful for hosting on subpaths) | - |
8081
| `DROIDGROUND_APP_PACKAGE_NAME` | Package name of target app | - |
8182
| `DROIDGROUND_ADB_HOST` | ADB host | `localhost` |
8283
| `DROIDGROUND_ADB_PORT` | ADB port | `5037` |
@@ -98,6 +99,7 @@ The `.env.sample` file in the root directory is a good starting point. This is t
9899
| `DROIDGROUND_START_RECEIVER_DISABLED` | Disable broadcast | `false` |
99100
| `DROIDGROUND_START_SERVICE_DISABLED` | Disable startService | `false` |
100101
| `DROIDGROUND_TERMINAL_DISABLED` | Disable terminal | `false` |
102+
| `DROIDGROUND_RESET_DISABLED` | Disable reset | `false` |
101103
| `DROIDGROUND_EXPLOIT_APP_DURATION` | The time (in seconds) the exploit app will be active | `10` |
102104

103105
## 🧩 Use Cases
@@ -144,6 +146,10 @@ Here are some suggestions for setting up your Android CTF:
144146
- Be careful when enabling the **Shutdown** feature.
145147
- If you plan to make the flag directly visible in the UI you may want to find a way to spawn different instances (one for each team/player)
146148

149+
While testing the setup before going in production it could be useful to get the **attack surface** of the target app. This is something that players shouldn't see because it's part of their job to discover and analyze the attack surface!
150+
151+
Therefore, a `GET` endpoint reachable at `/attackSurface` is provided and protected with a token (that needs to be used as the value of the `Authorization` header) that is randomly generated during the boot and printed in the logs (therefore accessible only by sysadmins).
152+
147153
## 🛠 Development
148154

149155
Getting it up & running shouldn't be too difficult, but before starting you should have the following tools installed:

package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "droidground",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"type": "module",
55
"author": "Angelo Delicato",
66
"scripts": {

src/client/layout/Header.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ const Navbar: React.FC = () => {
107107
</li>
108108
))}
109109
</ul>
110-
<button className="btn btn-error ml-4" onClick={() => resetCtfDialogRef.current?.showModal()}>
111-
Reset
112-
</button>
110+
{featuresConfig.resetEnabled && (
111+
<button className="btn btn-error ml-4" onClick={() => resetCtfDialogRef.current?.showModal()}>
112+
Reset
113+
</button>
114+
)}
113115
<div className="flex h-full items-center justify-center">
114116
<div className="flex h-[1.5rem]">
115117
<div className="divider divider-horizontal" />

src/client/views/Overview.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ export const Overview: React.FC = () => {
1616
isRunning: false,
1717
});
1818
const isPowerMenuEnabled = featuresConfig.shutdownEnabled || featuresConfig.rebootEnabled;
19-
const isActionsEnabled =
20-
featuresConfig.startActivityEnabled ||
21-
featuresConfig.startBroadcastReceiverEnabled ||
22-
featuresConfig.startServiceEnabled;
2319
// Dialogs
2420
const startActivityDialogRef = useRef<HTMLDialogElement | null>(null);
2521
const startBroadcastReceiverDialogRef = useRef<HTMLDialogElement | null>(null);
@@ -171,22 +167,22 @@ export const Overview: React.FC = () => {
171167
</div>
172168
</div>
173169
{/* Actions */}
174-
{isActionsEnabled && (
175-
<div className="collapse collapse-arrow bg-base-300 border border-base-300">
176-
<input type="checkbox" name="actions-accordion" className="peer" />
177-
<div className="collapse-title font-semibold peer-hover:bg-gray-600 peer-checked:mb-4">Actions</div>
178-
<div className="collapse-content text-sm flex flex-col items-center justify-between gap-4">
179-
<div className="flex w-full justify-between items-center">
180-
<p>
181-
Restart <b>App</b>
182-
</p>
183-
<div className="join">
184-
<button className="btn btn-accent join-item rounded-r-md" onClick={restartApp}>
185-
Restart
186-
</button>
187-
</div>
170+
<div className="collapse collapse-arrow bg-base-300 border border-base-300">
171+
<input type="checkbox" name="actions-accordion" className="peer" />
172+
<div className="collapse-title font-semibold peer-hover:bg-gray-600 peer-checked:mb-4">Actions</div>
173+
<div className="collapse-content text-sm flex flex-col items-center justify-between gap-4">
174+
<div className="flex w-full justify-between items-center">
175+
<p>
176+
Restart <b>App</b>
177+
</p>
178+
<div className="join">
179+
<button className="btn btn-accent join-item rounded-r-md" onClick={restartApp}>
180+
Restart
181+
</button>
188182
</div>
183+
</div>
189184

185+
{featuresConfig.startActivityEnabled && (
190186
<div className="flex w-full justify-between items-center">
191187
<p>
192188
Start <b>Activity</b>
@@ -200,7 +196,9 @@ export const Overview: React.FC = () => {
200196
</button>
201197
</div>
202198
</div>
199+
)}
203200

201+
{featuresConfig.startBroadcastReceiverEnabled && (
204202
<div className="flex w-full justify-between items-center">
205203
<p>
206204
Send <b>Broadcast Intent</b>
@@ -214,7 +212,9 @@ export const Overview: React.FC = () => {
214212
</button>
215213
</div>
216214
</div>
215+
)}
217216

217+
{featuresConfig.startServiceEnabled && (
218218
<div className="flex w-full justify-between items-center">
219219
<p>
220220
Start <b>Service</b>
@@ -228,9 +228,9 @@ export const Overview: React.FC = () => {
228228
</button>
229229
</div>
230230
</div>
231-
</div>
231+
)}
232232
</div>
233-
)}
233+
</div>
234234
{/* Power Menu */}
235235
{isPowerMenuEnabled && (
236236
<div className="collapse collapse-arrow bg-base-300 border border-base-300">

src/server/api/routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default (app: Router) => {
7272
validateBody<StartExploitAppRequest>(runExploitAppSchema),
7373
APIController.startExploitApp,
7474
);
75-
endpoint.post(E.RESET, APIController.reset);
75+
endpoint.post(E.RESET, checkFeatureEnabled(features.resetEnabled), APIController.reset);
7676
endpoint.get(E.FEATURES, APIController.features);
7777
endpoint.get(E.INFO, APIController.info);
7878
endpoint.post(E.RESTART, APIController.restartApp);

src/server/manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class ManagerSingleton {
6161
startBroadcastReceiverEnabled: !(process.env.DROIDGROUND_START_RECEIVER_DISABLED === "true"),
6262
startServiceEnabled: !(process.env.DROIDGROUND_START_SERVICE_DISABLED === "true"),
6363
terminalEnabled: !(process.env.DROIDGROUND_TERMINAL_DISABLED === "true"),
64+
resetEnabled: !(process.env.DROIDGROUND_RESET_DISABLED === "true"),
6465
fridaType: process.env.DROIDGROUND_FRIDA_TYPE === "full" ? "full" : "jail",
6566
exploitAppDuration:
6667
isNaN(exploitAppDuration) || exploitAppDuration.trim().length === 0 ? 10 : parseInt(exploitAppDuration),
@@ -252,6 +253,7 @@ export class ManagerSingleton {
252253
return false;
253254
}
254255

256+
Logger.info("Running setup.sh script...");
255257
execSync(setupScript, { cwd: process.env.DROIDGROUND_INIT_SCRIPTS_FOLDER }).toString().trim();
256258

257259
// Check if the app is installed, otherwise stop DroidGround

src/shared/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface DroidGroundFeatures {
1414
appManagerEnabled: boolean;
1515
terminalEnabled: boolean;
1616
logcatEnabled: boolean;
17+
resetEnabled: boolean;
1718
fridaType: "full" | "jail";
1819
exploitAppDuration: number;
1920
}

0 commit comments

Comments
 (0)