GHSA-gxrg-x694-283w: Medium severity composer/solspace/craft-freeform vulnerability
Summary
A limited server-side Twig template injection issue was identified in Solspace Freeform for Craft CMS. In affected versions, submitted form field values could be evaluated as Twig in certain rendering contexts.
Unauthenticated users could submit Twig expressions through public Freeform forms and have those expressions evaluated when the submitted values were rendered back into the form response. Confirmed impact includes disclosure of limited server/environment information, such as the PHP version and absolute filesystem paths.
No evidence was found that this issue allowed access to Craft globals, environment variables, database credentials, mailer credentials, security keys, or remote code execution in the tested environment.
Details
Plugin: Solspace Freeform Affected versions: Freeform 5.0.0 through 5.10.13 CMS: Craft CMS Authentication required: None Attack vector: Public Freeform form submission
Submitted field values were passed through Freeform’s isolated Twig renderer. As a result, Twig expressions included in submitted values could be evaluated server-side and reflected in the HTTP response.
The isolated Twig context appears to limit the available functions and globals. Confirmed accessible values were limited to PHP/core constants and Craft bootstrap constants such as:
twig {{ constant('PHPVERSION') }} {{ constant('PHPOS') }} {{ constant('CRAFTBASEPATH') }} {{ constant('CRAFTVENDORPATH') }}
Testing did not confirm access to:
text craft craft.app alias() getenv() database credentials mailer credentials Craft security key Craft license key environment variables
Proof of Concept
1. Submit a public Freeform form.
2. Inject the following payload into an email field:
twig {{ constant('PHPVERSION') }}@example.com
The response may reflect the evaluated PHP version, for example:
html value="8.2.27@example.com"
3. Inject the following payload into a text field:
twig {{ constant('CRAFTVENDORPATH') }}
The response may reflect the absolute vendor path, for example:
text /var/www/example-site/production/vendor/
Impact
An unauthenticated attacker with access to a public Freeform form could cause limited Twig expressions to be evaluated server-side.
Confirmed impact includes:
text PHP version disclosure Operating system/platform disclosure Absolute filesystem path disclosure Potential form rendering errors from malformed Twig input
This could assist with environment fingerprinting or be used in combination with other vulnerabilities. However, no credential disclosure, Craft application access, arbitrary file read, or remote code execution was confirmed.
Remediation
Freeform should treat submitted field values as plain user input and should not evaluate them as Twig. Twig rendering should be limited to trusted/admin-authored templates and configuration values.
This issue has been resolved by preventing submitted field values from being rendered as Twig in the affected context.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/solspace/craft-freeformto a version that resolves this vulnerability.Fixed in 5.10.14 - Configuration
Prevent submitted Freeform field values from being rendered or evaluated as Twig; limit Twig rendering to trusted, admin-authored templates and configuration values.
Solspace Freeform for Craft CMS Twig rendering of submitted field values = disabled
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Craft CMS deployments using Solspace Freeform versions 5.0.0 through 5.10.13 are affected when they expose public Freeform forms whose submitted values are rendered back into the form response in the vulnerable rendering context.
What does an attacker need to exploit it?
No authentication or user interaction is required. An attacker can submit Twig expressions through a public Freeform form and trigger evaluation when the submitted value is rendered in the response.
What impact has been confirmed?
Confirmed impact is limited disclosure of server or environment information, including the PHP version and absolute filesystem paths. Testing found no access to Craft globals, environment variables, database or mailer credentials, security keys, or remote code execution.
How can I identify possible exploitation attempts?
Review submissions to public Freeform forms for Twig expressions or other template syntax in field values, particularly where those values are reflected in form responses. The provided information does not identify a specific log signature or payload pattern.