Why? It seems like they should have read/write but no execute. What goes wrong?
Why? It seems like they should have read/write but no execute. What goes wrong?
> When uploading image files, GitLab Workhorse passes any files with the extensions jpg|jpeg|tiff through to ExifTool to remove any non-whitelisted tags.
> An issue with this is that ExifTool will ignore the file extension and try to determine what the file is based on the content, allowing for any of the supported parsers to be hit instead of just JPEG and TIFF by just renaming the uploaded file.
> One of the supported formats is DjVu. When parsing the DjVu annotation, the tokens are evaled to "convert C escape sequences".
Usually what goes wrong is parsing or processing the files. It's hard to get programmers to safely validate a 20 byte email address string. It takes a lot more care to safely parse a 4,000,000 byte image file in a complex format.
1. No filesystem access
2. No network access
3. Input passed on stdin (or a pre-opened fd)
4. Output passed to stdout (or a pre-opened fd)
5. A hard timeout specified before the process is killed
Suddenly bam, dramatically safer.
If you're looking for a tool that can do all of this for you, check out firejail:
https://firejail.wordpress.com/
It has a ton of options, but you can do all of what I suggested and more, really easily.
A user input facing software should always use fuzzing to uncover such bugs.
Off the top of my head, a lot of old console exploits on the Wii and GameCube revolved feeding malicious save files to games. Same idea, missing bounds checks or whatever when deserializing some field lets you shell the process. Parsing random files from users is just dangerous.