CVE-2021-3888

8.1 HIGH

📋 TL;DR

CVE-2021-3888 is a use-after-free vulnerability in libmobi, a library for handling MOBI eBook files. Attackers can exploit this by crafting malicious MOBI files to cause arbitrary code execution or denial of service. Applications using vulnerable versions of libmobi to process untrusted MOBI files are affected.

💻 Affected Systems

Products:
  • libmobi
Versions: Versions before commit c78e186739b50d156cb3da5d08d70294f0490853
Operating Systems: All platforms where libmobi is used (Linux, Windows, macOS)
Default Config Vulnerable: ⚠️ Yes
Notes: Any application that uses libmobi to parse MOBI files is vulnerable. This includes eBook readers, document converters, and file analysis tools.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the application processing the MOBI file, potentially leading to complete system compromise.

🟠

Likely Case

Application crash (denial of service) when processing malicious MOBI files, potentially disrupting services that handle eBook files.

🟢

If Mitigated

Limited to denial of service if proper sandboxing or privilege separation is implemented.

🌐 Internet-Facing: MEDIUM - Risk exists if applications process user-uploaded MOBI files, but requires specific file processing scenarios.
🏢 Internal Only: LOW - Typically requires user interaction to open malicious files or automated processing of untrusted content.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires the victim to process a malicious MOBI file. Proof-of-concept code is available in public repositories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in commit c78e186739b50d156cb3da5d08d70294f0490853

Vendor Advisory: https://github.com/bfabiszewski/libmobi/commit/c78e186739b50d156cb3da5d08d70294f0490853

Restart Required: No

Instructions:

1. Update libmobi to version including commit c78e186739b50d156cb3da5d08d70294f0490853
2. Recompile any applications using libmobi
3. Replace existing libmobi installations with patched version

🔧 Temporary Workarounds

Disable MOBI file processing

all

Temporarily disable processing of MOBI files in affected applications until patched

Sandbox file processing

linux

Run applications that process MOBI files in isolated containers or with reduced privileges

docker run --read-only --cap-drop=ALL -v /tmp:/tmp:ro application

🧯 If You Can't Patch

  • Implement strict file upload validation to reject suspicious MOBI files
  • Use application allowlisting to prevent execution of untrusted applications that might process MOBI files

🔍 How to Verify

Check if Vulnerable:

Check libmobi version or commit hash against vulnerable versions. Use: strings /path/to/libmobi.so | grep 'libmobi'

Check Version:

pkg-config --modversion libmobi 2>/dev/null || echo 'libmobi not found via pkg-config'

Verify Fix Applied:

Verify the installed libmobi includes commit c78e186739b50d156cb3da5d08d70294f0490853

📡 Detection & Monitoring

Log Indicators:

  • Application crashes when processing MOBI files
  • Memory access violation errors in application logs

Network Indicators:

  • Unusual file uploads of MOBI files to web applications
  • Multiple failed file processing attempts

SIEM Query:

source="application.log" AND ("segmentation fault" OR "access violation") AND "mobi"

🔗 References

📤 Share & Export