diff --git a/README.md b/README.md index 0204ca9..845f4c4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ - [aaaa/seeing-stars](aaaa/seeing-stars) - [aaaa/spacebook](aaaa/spacebook) - [comms/56k](comms/56k) -- [ground-segment/phasors-to-stun](ground-segment/phasors-to-stun) +- [comms/phasors-to-stun](comms/phasors-to-stun) +- [payload/calendar](payload/calendar) - [payload/leakycrypto](payload/leakycrypto) - [satellite-bus/bytes-away](satellite-bus/bytes-away) - [satellite-bus/magic-bus](satellite-bus/magic-bus) diff --git a/ground-segment/phasors-to-stun/README.md b/comms/phasors-to-stun/README.md similarity index 96% rename from ground-segment/phasors-to-stun/README.md rename to comms/phasors-to-stun/README.md index a375eb5..98533d5 100644 --- a/ground-segment/phasors-to-stun/README.md +++ b/comms/phasors-to-stun/README.md @@ -1,6 +1,6 @@ # Phasors to Stun -**Category:** Ground Segment +**Category:** Communication Systems **Points (final):** 62 **Solves:** 71 diff --git a/ground-segment/phasors-to-stun/signal.png b/comms/phasors-to-stun/signal.png similarity index 100% rename from ground-segment/phasors-to-stun/signal.png rename to comms/phasors-to-stun/signal.png diff --git a/ground-segment/phasors-to-stun/urh1.png b/comms/phasors-to-stun/urh1.png similarity index 100% rename from ground-segment/phasors-to-stun/urh1.png rename to comms/phasors-to-stun/urh1.png diff --git a/ground-segment/phasors-to-stun/urh2.png b/comms/phasors-to-stun/urh2.png similarity index 100% rename from ground-segment/phasors-to-stun/urh2.png rename to comms/phasors-to-stun/urh2.png diff --git a/ground-segment/.gitkeep b/ground-segment/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/payload/calendar/Dockerfile b/payload/calendar/Dockerfile new file mode 100644 index 0000000..65730c7 --- /dev/null +++ b/payload/calendar/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:18.04 + +RUN apt-get update -y && apt-get install -y \ + cmake \ + freeglut3 \ + freeglut3-dev \ + gcc \ + g++ \ + git \ + iproute2 \ + libffi-dev \ + libgdbm-dev \ + libgdbm5 \ + libgstreamer-plugins-base1.0-dev \ + libgstreamer1.0-dev \ + libncurses5-dev \ + libreadline6-dev \ + libsmokeqt4-dev \ + libssl-dev \ + libyaml-dev \ + net-tools \ + qt4-default \ + qt4-dev-tools \ + ruby2.5 \ + ruby2.5-dev \ + vim \ + zlib1g-dev + +RUN apt-get install -y bundler + +WORKDIR /cosmos +CMD /bin/bash diff --git a/payload/calendar/README.md b/payload/calendar/README.md new file mode 100644 index 0000000..83329e6 --- /dev/null +++ b/payload/calendar/README.md @@ -0,0 +1,78 @@ +# That's not on my calendar + +**Category:** Payload Modules +**Points (final):** 80 +**Solves:** 52 + +>Time for a really gentle introduction to cFS and Cosmos, hopefully you can schedule time to learn +>it! +> +>Build instructions: +> +>$ ./setup.sh $ source ~/.bashrc $ rm Gemfile.lock $ bundle install +> +>Hint: You will need to enable telemetry locally on the satellite, the udp forwarder will provide it +>to you as TCP from there + +## Write-up + +by [haskal](https://awoo.systems) + +Two files are provided, one is a [COSMOS](https://cosmosrb.com/) directory tree for accessing a +virtual satellite running [NASA's Core Flight System](https://cfs.gsfc.nasa.gov/) that can be booted +up using the provided netcat endpoint. COSMOS is an open-source command and control framework for +satellites using cFS. Booting up COSMOS is enormously complicated, so Docker can be used to automate +the setup. We adapted the Ball Aerospace COSMOS Docker image, and created a script to configure +COSMOS to connect to the CTF's satellite instance automatically by writing the configuration file at +`cosmos/config/tools/cmd_tlm_server/cmd_tlm_server.txt`. When COSMOS is successfully connected to +the CTF instance it looks like this (no themes were installed in the Docker container so it looks +like Windows 95, I'm so sorry,) + +![Main COSMOS screen](cosmos1.png) + +The second file is an archive of some JSON configuration for the satellite operating system. +Importantly, it contains the types of telemetry messages the satellite can send, and the default +scheduler table that configures when the satellite sends the messages. There is a telemetry packet +that sends us the flag configured here + +```json + {"message": { + "name": "KIT_TO_SEND_FLAG_MID", + "descr": "Super Secret Flag Sending Telemetry Message", + "id": 42, + "stream-id": 33304, + "seq-seg": 192, + "length": 256 + }}, +``` + +As hinted in the description, we can send a KIT_TO ENABLE_TELEMETRY command using the COSMOS command +sender. KIT_TO is the subsystem for Telemetry Output, and it has commands available to control the +telemetry sending. + +![COSMOS sending an ENABLE_TELEMETRY command](cosmos2.png) + +However we find that even after telemetry is enabled, we're not getting the flag telemetry even +though we start to receive other types of telemetry messages. + +![COSMOS telemetry viewer, we have 0 flag packets](cosmos3.png) + +This is because, if we look back at the JSON config we find that the scheduler doesn't have any +slots where it sends flag telemetry packets. The key part of this challenge is that the scheduler +can be configured at runtime using commands for KIT_SCH (the scheduler subsystem), as we found out +by exploring the available commands in COSMOS. Particularly there is a command LOAD_SCH_ENTRY that +allows us to overwrite one of the scheduler entries. We can use the command sender to send this +command and load slot 0, activity 0 (or any slot, it doesn't matter) to be for message ID 42 (the +flag packet ID), and to be enabled (1). + +![COSMOS sending this LOAD_SCH_ENTRY command](cosmos4.png) + +Once we write the scheduler entry, the satellite will start sending COSMOS flags, which can be seen +in the Packet Viewer. + +![COSMOS packet viewer showing the flag](cosmos5.png) + +## Resources and other writeups + + * + * diff --git a/payload/calendar/cosmos1.png b/payload/calendar/cosmos1.png new file mode 100644 index 0000000..ccfbc64 Binary files /dev/null and b/payload/calendar/cosmos1.png differ diff --git a/payload/calendar/cosmos2.png b/payload/calendar/cosmos2.png new file mode 100644 index 0000000..a3c2f3a Binary files /dev/null and b/payload/calendar/cosmos2.png differ diff --git a/payload/calendar/cosmos3.png b/payload/calendar/cosmos3.png new file mode 100644 index 0000000..9261320 Binary files /dev/null and b/payload/calendar/cosmos3.png differ diff --git a/payload/calendar/cosmos4.png b/payload/calendar/cosmos4.png new file mode 100644 index 0000000..1437ec9 Binary files /dev/null and b/payload/calendar/cosmos4.png differ diff --git a/payload/calendar/cosmos5.png b/payload/calendar/cosmos5.png new file mode 100644 index 0000000..dfc4370 Binary files /dev/null and b/payload/calendar/cosmos5.png differ diff --git a/payload/calendar/launch-docker.sh b/payload/calendar/launch-docker.sh new file mode 100644 index 0000000..a366155 --- /dev/null +++ b/payload/calendar/launch-docker.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -e DISPLAY -e QT_X11_NO_MITSHM=1 --net=host -v $PWD/cosmos:/cosmos cosmos2 bash