Impact This vulnerability allows attackers to execute arbitrary code when you use Validation Placeholders.
The vulnerability exists in the Validation library, and validation methods in the controller and in-model validation are also vulnerable because they use the Validation library internally.
Patches Upgrade to v4.3.5 or later.
Workarounds Setting validation rules with an array.
E.g.: php $validation->setRules([ 'email' => ['required', 'validemail, 'isunique[users.email,id,{id}]'], ]);
References - https://codeigniter4.github.io/userguide/libraries/validation.html#validation-placeholders - https://codeigniter4.github.io/userguide/incoming/controllers.html#validating-data - https://codeigniter4.github.io/userguide/models/model.html#in-model-validation
For more information If you have any questions or comments about this advisory: Open an issue in codeigniter4/CodeIgniter4 Email us at SECURITY.md
Impact This vulnerability affects applications that: Use the ImageMagick handler for image processing (imagick as the image library) AND either: Allow file uploads with user-controlled filenames and process uploaded images using the resize() method OR use the text() method with user-controlled text content or options
An attacker can: Upload a file with a malicious filename containing shell metacharacters that get executed when the image is processed OR provide malicious text content or options that get executed when adding text to images
Patches Upgrade to v4.6.2 or later.
Workarounds Switch to the GD image handler (gd, the default handler), which is not affected by either vulnerability For file upload scenarios: Instead of using user-provided filenames, generate random names to eliminate the attack vector with getRandomName() when using the move() method, or use the store() method, which automatically generates safe filenames For text operations: If you must use ImageMagick with user-controlled text, sanitize the input to only allow safe characters: pregreplace('/[^a-zA-Z0-9\s.,!?-]/', '', $text) and validate/restrict text options
References OWASP Command Injection Prevention CWE-78: OS Command Injection
Impact This is an unsafe file upload validation vulnerability that can lead to remote code execution in vulnerable application configurations.
Applications are impacted when they: - validate uploads using isimage or mimein without an independent safe extension check, such as extin on patched versions - save uploaded files using the client-supplied filename - place uploads in a web-accessible directory where PHP files can execute
Patches Upgrade to v4.7.4 or later.
Workarounds - Save uploads outside the public web root, preferably under writable/uploads. - Use $file->store() or $file->move($path, $file->getRandomName()) instead of preserving the original client filename. - Disable script execution in any public upload directory. - Manually verify the client filename extension before moving the file. - For image uploads, reject files when $file->getClientExtension() is not an allowed image extension. - For exact MIME-type validation, reject files when $file->getClientExtension() does not match $file->guessExtension().
Impact Deserialization of Untrusted Data was found in the old() function in CodeIgniter4. Remote attackers may inject auto-loadable arbitrary objects with this vulnerability, and possibly execute existing PHP code on the server. We are aware of a working exploit, which can lead to SQL injection.
Patches Upgrade to v4.1.6 or later.
Workarounds Do not use: - old() and formhelper - RedirectResponse::withInput() and redirect()->withInput()
References - PHP Object Injection | OWASP
For more information If you have any questions or comments about this advisory: Open an issue in codeigniter4/CodeIgniter4 Email us at SECURITY.md
Impact This vulnerability allows attackers to execute CLI routes via HTTP request.
Patches Upgrade to v4.1.9 or later.
Workarounds None.
For more information If you have any questions or comments about this advisory: Open an issue in codeigniter4/CodeIgniter4 Email us at SECURITY.md
CodeIgniter is a PHP full-stack web framework. When an application uses (1) multiple session cookies (e.g., one for user pages and one for admin pages) and (2) a session handler is set to DatabaseHandler, MemcachedHandler, or RedisHandler, then if an attacker gets one session cookie (e.g., one for user pages), they may be able to access pages that require another session cookie (e.g., for admin pages). This issue has been patched, please upgrade to version 4.2.11 or later. As a workaround, use only one session cookie.
CodeIgniter before 2.2.0 makes it easier for attackers to decode session cookies by leveraging fallback to a custom XOR-based encryption scheme when the Mcrypt extension for PHP is not available.
CodeIgniter arbitrary code execution
A Session Fixation issue exists in CodeIgniter before 3.1.10 because session.usestrictmode in the Session Library was mishandled.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php orlike() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php ornotlike() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php wherenotin() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php orhaving() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php orwherenotin() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php orwherein() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php like() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php where() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php wherein() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php having() function.
B.C. Institute of Technology CodeIgniter <=3.1.13 is vulnerable to SQL Injection via system\database\DBquerybuilder.php orwhere() function.
CodeIgniter and Kohana vulnerable to PHP Object Injection
Impact A SQL injection vulnerability exists in the Query Builder's deleteBatch() method. When deleteBatch() is used together with where() conditions, the bound values from the WHERE clause are substituted directly into the generated SQL with their escape flag ignored, so they are never escaped or quoted. If an application passes user-controlled input to where() before calling deleteBatch(), that input is interpreted as SQL rather than as a value, allowing SQL injection.
This affects only the deleteBatch() code path. Regular delete() operations escape where() binds correctly.
Patches Upgrade to v4.7.4 or later.
Workarounds If you cannot upgrade immediately:
- Strictly validate and cast values (e.g. numeric IDs) before using them in conditions - though this does not fully protect string conditions. - Do not pass user-controlled input to where() when using deleteBatch(). - For user-controlled conditions, use a normal delete() with Query Builder binds instead of deleteBatch(). - Where possible, express required matching values through the batch data and onConstraint() rather than as separate user-controlled where() clauses.
CodeIgniter4 is the 4.x branch of CodeIgniter, a PHP full-stack web framework. A vulnerability in versions prior to 4.1.9 might allow remote attackers to bypass the CodeIgniter4 Cross-Site Request Forgery (CSRF) protection mechanism. Users should upgrade to version 4.1.9. There are workarounds for this vulnerability, but users will still need to code as these after upgrading to v4.1.9. Otherwise, the CSRF protection may be bypassed. If auto-routing is enabled, check the request method in the controller method before processing. If auto-routing is disabled, either avoid using $routes->add() and instead use HTTP verbs in routes; or check the request method in the controller method before processing.
CodeIgniter Improper Privilege Management
Impact This vulnerability may allow SameSite Attackers to bypass the CodeIgniter4 CSRF protection mechanism with CodeIgniter Shield.
For this attack to succeed, the attacker must have direct (or indirect, e.g., XSS) control over a subdomain site (e.g., https://a.example.com/) of the target site (e.g., http://example.com/).
This vulnerability exists whether Config\Security::$csrfProtection is 'cookie' or 'session'. It is also exploitable whether Config\Security::$regenerate is true or false.
Patches Upgrade to CodeIgniter v4.2.3 or later and Shield v1.0.0-beta.2 or later.
Workarounds Do all of the following: - set Config\Security::$csrfProtection to 'session' - remove old session data right after login (immediately after ID and password match) - regenerate CSRF token right after login (immediately after ID and password match)
References - CodeIgniter4 CSRF Protection - SameSite Attacks - SameSite Cookies - The great SameSite confusion
For more information If you have any questions or comments about this advisory: Open an issue or discussion in codeigniter4/shield Email us at security@codeigniter.com
CodeIgniter is a PHP full-stack web framework. When an application uses (1) multiple session cookies (e.g., one for user pages and one for admin pages) and (2) a session handler is set to DatabaseHandler, MemcachedHandler, or RedisHandler, then if an attacker gets one session cookie (e.g., one for user pages), they may be able to access pages that require another session cookie (e.g., for admin pages). This issue has been patched, please upgrade to version 4.2.11 or later. As a workaround, use only one session cookie.
Impact A vulnerability was found in the Language class that allowed DoS attacks. This vulnerability can be exploited by an attacker to consume a large amount of memory on the server.
Patches Upgrade to v4.4.7 or later. See upgrading guide.
Workarounds - Disabling Auto Routing prevents a known attack vector in the framework. - Do not pass invalid values to the lang() function or Language class.
References - https://codeigniter4.github.io/userguide/outgoing/localization.html#language-localization - https://codeigniter4.github.io/userguide/general/commonfunctions.html#lang
Impact In affected versions, calling UploadedFile::move() without a second argument uses the client-provided filename without sanitization. Depending on the destination path and server configuration, an attacker can supply a filename containing path traversal sequences (e.g. ../../public/shell.php) to write uploaded content outside the intended upload directory.
The patch sanitizes this default (no-argument) path.
Note: The patch only sanitizes the filename when no second argument is passed. If your application explicitly passes a client-provided name as the second argument, you remain responsible for sanitizing it - the patch does not (and cannot) sanitize a caller-supplied filename: php // Unsafe - even after upgrading: $file->move(WRITEPATH . 'uploads', $file->getName()); $file->move(WRITEPATH . 'uploads', $file->getClientName());
Patches Upgrade to v4.7.4 or later.
Workarounds If you cannot upgrade immediately, use a generated filename or sanitize the client filename before passing it to move().
Use a generated filename: php $file->move(WRITEPATH . 'uploads', $file->getRandomName()); Or sanitize the client filename before passing it to move(): php helper('security');
$name = sanitizefilename($file->getClientName()); $file->move(WRITEPATH . 'uploads', $name);
CodeIgniter is a PHP full-stack web framework. This vulnerability may allow attackers to spoof their IP address when the server is behind a reverse proxy. This issue has been patched, please upgrade to version 4.2.11 or later, and configure Config\App::$proxyIPs. As a workaround, do not use $request->getIPAddress().