PHP FormMail Generator generates code vulnerable to multiple issues
Vulnerability Note VU#608591
Original Release Date: 2017-03-07 | Last Revised: 2017-03-07
Overview
PHP forms generated using the PHP FormMail Generator are vulnerable to stored cross-site scripting and unrestricted upload of dangerous file types.
Description
PHP FormMail Generator is a website that generates PHP form code for inclusion in a PHP-based or Wordpress-based website. The code generated by the website prior to 17 December 2016 is vulnerable to the following:
CWE-434: Unrestricted Upload of File with Dangerous Type - CVE-2016-9492
In the generated form.lib.php file, upload file types are checked against a hard-coded list of dangerous extensions. This list does not include all variations of PHP files, which may lead to execution of the contained PHP code if the attacker can guess the uploaded filename. The form by default appends a short random string to the end of the filename.
CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) - CVE-2016-9493
The name and message fields of the generated PHP form do not properly validate input, allowing an attacker to submit a XSS payload that is then stored by the application. The XSS payload is executed when an administrator accesses the administrator panel.
Impact
An unauthenticated remote attacker may be able to conduct stored XSS attacks against the form administrator, or possibly execute PHP code on the server if the attacker can guess the uploaded filename.
Solution
A full solution is not currently known, however users may consider the following.
Regenerate your PHP form code
The PHP FormMail Generator website as of 2016-12-17 generates PHP code that addresses CVE-2016-9492. Affected users are encouraged to regenerate the PHP form code using the website, or manually apply patches.
However, CVE-2016-9493 is not confirmed addressed in the latest release. Users may manually update their form code to use PHP `htmlentities` or similar methods to prevent XSS in the fields. Alternately, users may need to consider a different form.