View Issue Details

IDProjectCategoryView StatusLast Update
0000705fileGeneralpublic2026-01-10 16:23
Reporterbana Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityhave not tried
Status feedbackResolutionopen 
Summary0000705: Question: Parsing untrusted data
DescriptionDuring some code reviews in other applications I came across multiple uses of file and libmagic where untrusted and sometimes even suspected malicious files were parsed to determine the file type. This seems kinda dangerous to me but I have not found any clear warnings or recommendations that would indicate if there are any recommended options to do this more safely or if this should be avoided altogether.
Considering how many application depend on this code, I am wondering if some general advice could be added to the documentation / man page

Thank you
TagsNo tags attached.

Activities

christos

2026-01-10 16:23

manager   ~0004335

Well, file is written in C and is bound to have bugs (it has had in the past). Some mitigations:
1. libmagic is constantly fuzzed by https://issues.oss-fuzz.com/issues?q=cc:zoulasc@gmail.com
2. you can compile it with sandboxing on linux so that it can execute system calls maliciously.
3. you can run in in a container or separate cgroup.

Issue History

Date Modified Username Field Change
2025-12-29 18:23 bana New Issue
2026-01-10 16:19 christos Assigned To => christos
2026-01-10 16:19 christos Status new => assigned
2026-01-10 16:23 christos Status assigned => feedback
2026-01-10 16:23 christos Note Added: 0004335