Summary
KindleEar's recipe upload workflow can execute Python code supplied in a malicious recipe when the recipe is compiled without sandboxing. An authenticated non-admin user who can submit a recipe for processing may gain code execution in the Docker container.
Affected context
The issue is reported in KindleEar versions 3.0.0 through 3.5.3. It occurs in the recipe upload workflow: source submitted to the /recipe/upload action is processed by calibre compile_recipe, which executes it using exec() without sandboxing. The risk applies when an authenticated non-admin user can submit a recipe that the application processes.
Exploit preconditions
- Attack surface: The recipe upload action at
/recipe/upload - Required access: An authenticated account with permission to upload recipes; administrator access is not required
- Trigger point: The application compiles a submitted recipe using
calibre compile_recipe - Why exploitation is possible: Recipe source is executed with
exec()without sandboxing or an equivalent isolation boundary
Why this happens
The application treats uploaded recipe source as executable Python and runs it without restricting its capabilities. This is code injection, mapped to CWE-94: Improper Control of Generation of Code: attacker-influenced input becomes executable code in the application's runtime context.
Potential impact
- An attacker may execute Python code in the Docker container, reportedly with root privileges.
- The container's files and runtime resources could be exposed or modified.
- Password hashes accessible to the container may be disclosed.
- The compromised environment could be used to affect connected services, depending on container permissions and network access.
General mitigation guidance
Mitigation patterns focus on not executing user-supplied code in a privileged application context.
- Prefer declarative, constrained recipe formats over arbitrary Python source.
- If recipe execution is essential, isolate it in a hardened sandbox with narrowly scoped filesystem, network, and process permissions.
- Run application components with least privilege and avoid granting root access to recipe-processing workloads.
- Limit who can submit recipes, and treat all uploaded content as untrusted.
- Keep secrets and password hashes outside the reach of recipe-processing processes where practical.
How teams detect issues like this
- Use static analysis to identify
exec()and other dynamic code execution paths that process user-controlled data. - Review recipe upload and compilation flows for missing isolation, authorization checks, or privilege boundaries.
- Apply policy checks that flag execution of uploaded source and restrict privileged container workloads.
- Monitor recipe-processing activity for unexpected process launches, file access, or outbound network connections.
- Automated code review tools can help identify dynamic execution patterns for manual assessment.

