In Linux, pseudofiles are files that don’t really exist on disk as stored data, but represent some other entity, be it a device, kernel data structures, or runtime state. In the case of firmware rehosting, we will often want to create models for the pseudofiles in /dev that do not exist due to missing hardware or drivers.
The pseudofiles built-in penguin plugin manages and interacts with the penguin tooling to create and manage pseudofiles that the guest will use.
This is a constructed challenge that will require you to set up a pseudofile and model correct behavior the firmware expects when it tries to read from the pseudofile. Once you have the correct behavior modeled the program will print the solution for you to obtain the flag.
The file /challenge/pseudofiles-1.rootfs.tar.gz contains the rootfs for you to use.
The source for the challenge binary is available at /challenge/pseudofiles-1.c`
Feel free to use the example below as a starting point for your model:
pseudofiles:
/dev/wrongdevice:
write:
model: discard
read:
model: const_buf
val: "The contents we need will be here"
It is recommened you store your model in a patch file by itself rather than editing config.yaml directly. Patch files are applied on top of the existing configuration. You can specify a file in the patches section of the configuration (note that we automatically generate some from static analysis) or files with names like patch_NAME.yaml in the project directory will automatically be applied.
Notes:
- Comment out or delete the line
static_patches/pseudofiles.dynamic.yaml from config.yaml, otherwise you will get configuration validation errors with your new model since a model for that device already exists.
- In this course "constructed challenges" represent artificial firmwares that we've created to highlight a particular rehosting challenge
- Building isolated examples can be useful for troubleshooting rehostings. You can build your own using the build_basic_rootfs.py script.
- Instead of looking at console.log, you can have the device's console print to stdout by copying
/examples/patch_output.yaml into your project.
- Your key for
/challenge/solve will be wrapped in IGLOO{}. That is meant for the key to be easier to find in system console output and should also be included in the string you pass to /challenge/solve