Skip to content

[Security] Fix RCE via unsafe eval in metadata parsing - #4207

Open
Kwstubbs wants to merge 1 commit into
lllyasviel:mainfrom
Kwstubbs:fix/ghsl-2024-196-eval-rce
Open

[Security] Fix RCE via unsafe eval in metadata parsing #4207
Kwstubbs wants to merge 1 commit into
lllyasviel:mainfrom
Kwstubbs:fix/ghsl-2024-196-eval-rce

Conversation

@Kwstubbs

Copy link
Copy Markdown

Security fix to replace eval() with ast.literal_eval() in modules/meta_parser.py.

Replace eval() with ast.literal_eval() in modules/meta_parser.py.

The metadata parser called eval() on attacker-controllable values from
image metadata / the prompt-parameters input (styles, resolution,
adm_guidance, freeu), allowing arbitrary code execution when importing
crafted metadata. These fields only ever contain Python literals
(lists/tuples of numbers and strings), so ast.literal_eval is a safe
drop-in replacement that rejects any non-literal payload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant