Summary
IO::Socket::SSL::PublicSuffix can inject and execute Perl code when its updater incorporates a fetched list line that closes the module's built-in data heredoc. An attacker who controls the fetched list may cause code to run in processes that load the module, if the updater can also write to the installed module file.
Affected context
The issue affects the module's self-update process, which rewrites its source file using lines fetched from a URL. It becomes risky when an attacker can control the fetched list and the updater has write access to the installed module. Because IO::Socket::SSL loads this module unconditionally, altered code may run in processes that subsequently load IO::Socket::SSL, until the file is replaced or repaired.
Exploit preconditions
- Attack surface: The module's list-fetching and self-update functionality.
- Required access: Control over the fetched list, through the cleartext default URL or a caller-supplied URL, and the ability for the updater to write to the installed module.
- Trigger point: The updater runs and rewrites the module using fetched list lines.
- Why exploitation is possible: A fetched line can match the built-in heredoc terminator; subsequent lines are then written as Perl source without domain-format validation.
Why this happens
The updater appends fetched lines to a source file that embeds built-in data in a heredoc. It does not validate that each line is a domain or safely encode content for that context, so a line matching the heredoc terminator can end the data section and cause following lines to be interpreted as Perl code. This is code injection, mapped to CWE-94: Improper Control of Generation of Code.
Potential impact
- An attacker may execute arbitrary Perl code in processes that load the altered module.
- The injected code could access data or resources available to those processes.
- The compromise could persist until the modified module file is reinstalled or otherwise restored.
- The consequences could extend to other systems or services accessible to the affected process.
General mitigation guidance
Defensive patterns include separating fetched data from executable source and using data formats or storage locations that cannot alter program structure. Treat fetched content as untrusted: validate it against a strict domain-list schema, reject unexpected lines, and use safe encoding when generating files. Prefer authenticated, integrity-checked transport and trusted sources, restrict who can configure update URLs, and limit updater write permissions to the minimum necessary. Run affected processes with least privilege and protect installed code from routine runtime modification.
How teams detect issues like this
- Use static analysis and code review to identify fetched data written into source files or heredocs without context-aware validation or encoding.
- Review update paths for checks that enforce the expected domain-list format and reject heredoc delimiters or other unexpected content.
- Monitor changes to installed module files and alert on modifications outside approved maintenance workflows.
- Apply policies requiring authenticated, integrity-checked sources and limiting which components can write to installed code.

