CodeIgniter 3
CodeIgniter 3 is the previous version of the popular PHP web framework. Maintenance of CodeIgniter 3 is slow though ongoing nowadays. Most maintainers have moved to CodeIgniter 4.
Versions of CodeIgniter 3
The latest CodeIgniter 3 release, 3.1.13 from March 3rd 2022, can be downloaded from
this site. Some fixes and improvements have been made
since then. They are available on the default develop
branch on GitHub.
These changes are not part of any official release.
XSS in CodeIgniter 3 via user controlled load->view
The latest release of CodeIgniter 3 is vulnerable to XSS
[3] when userinput is passed into
$this->load->view($page);
. A fix exists, but was never merged [4].
This applies to both the latest release and the latest development version.
Take this example code of a minimal CodeIgniter 3 controller inserting userinput into the load->view
function:
Since the requested view does not exist, CodeIgniter 3 will emit the error message Unable to load the requested file: $REQUESTED_VIEW .php
. The value of $REQUESTED_VIEW
is not sanitized however, allowing an attacker to inject HTML/
JavaScript into the DOM.
The XSS is triggered by wrapping a JavaScript payload in script tags and passing it to the vulnerable parameter.
You can find a full PoC project here.
This vulnerability was discovered by Antoine Cervoise and Maxime Rinaudo at Synacktiv. See their vulnerability report [3].