CVE-2022-21715: XSS Vulnerability in API\ResponseTrait in CodeIgniter4

Published Jan 24, 2022
·
Updated

Impact Cross-Site Scripting (XSS) vulnerability was found in API\ResponseTrait in Codeigniter4. Attackers can do XSS attacks if you are using API\ResponseTrait.

Patches Upgrade to v4.1.8 or later.

Workarounds Do one of the following: 1. Do not use API\ResponseTrait nor ResourceController 2. Disable Auto Route and Use Defined Routes Only

References - Cross Site Scripting (XSS) Software Attack | OWASP Foundation

For more information If you have any questions or comments about this advisory: Open an issue in codeigniter4/CodeIgniter4 Email us at SECURITY.md

Other sources

CodeIgniter4 is the 4.x branch of CodeIgniter, a PHP full-stack web framework. A cross-site scripting (XSS) vulnerability was found in API\ResponseTrait in Codeigniter4 prior to version 4.1.8. Attackers can do XSS attacks if a potential victim is using API\ResponseTrait. Version 4.1.8 contains a patch for this vulnerability. There are two potential workarounds available. Users may avoid using API\ResponseTrait or ResourceController Users may also disable Auto Route and use defined routes only.

— NVD

CVE-2022-21715: XSS Vulnerability in API\ResponseTrait in CodeIgniter4

Affected Software

4 affected componentsFixes available
composer/codeigniter4/framework<4.1.8
composer/codeigniter4/framework<4.1.8
4.1.8
CodeIgniter Codeigniter>=4.0.0<4.1.8
composer/codeigniter4/framework<4.1.8
4.1.8

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/codeigniter4/framework to a version that resolves this vulnerability.

    Fixed in 4.1.8
  2. Upgrade

    Upgrade CodeIgniter4 to a version that resolves this vulnerability.

    Fixed in 4.1.8
  3. Configuration

    Disable Auto Route and use defined routes only.

    CodeIgniter4 routing Auto Route = disabled; use defined routes only
  4. Compensating control

    Do not use API\ResponseTrait or ResourceController.

Event History

Jan 24, 2022
Advisory Published
05:41 PM
Data Sourced
via Packagist·05:41 PM
DescriptionSeverityAffected Software
CVE Published
via MITRE·07:55 PM
Data Sourced
via MITRE·07:55 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2022-21715?

CVE-2022-21715 is a medium severity vulnerability due to its potential for Cross-Site Scripting (XSS) attacks.

2

How do I fix CVE-2022-21715?

To fix CVE-2022-21715, upgrade your CodeIgniter4 version to 4.1.8 or later.

3

What component is affected by CVE-2022-21715?

CVE-2022-21715 affects the 'API\ResponseTrait' component in CodeIgniter4.

4

What is the exploitability of CVE-2022-21715?

CVE-2022-21715 can be exploited by attackers to perform XSS attacks in applications using the affected component.

5

Are there any workarounds for CVE-2022-21715?

A workaround for CVE-2022-21715 is to avoid using the 'API\ResponseTrait' until an upgrade is performed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203