what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

ExpressionEngine 6.0.2 PHP Code Injection

ExpressionEngine 6.0.2 PHP Code Injection
Posted Mar 15, 2021
Authored by EgiX | Site karmainsecurity.com

ExpressionEngine versions 6.0.2 and below suffer from a Translate::save PHP code injection vulnerability.

tags | exploit, php
advisories | CVE-2021-27230
SHA-256 | 194597ced97a35c6d247729d6a66efa739186e83e8e19c865571433ee7b78ee3

ExpressionEngine 6.0.2 PHP Code Injection

Change Mirror Download
----------------------------------------------------------------------------
ExpressionEngine <= 6.0.2 (Translate::save) PHP Code Injection
Vulnerability
----------------------------------------------------------------------------


[-] Software Link:

https://expressionengine.com/


[-] Affected Versions:

Version 6.0.2 and prior versions.
Version 5.4.1 and prior versions.


[-] Vulnerability Description:

The vulnerable code is located in the
"ExpressionEngine\Controller\Utilities\Translate::save()" method:

362. private function save($language, $file)
363. {
364.
365. $file = ee()->security->sanitize_filename($file);
366.
367. $dest_dir = $this->languages_dir . $language . '/';
368. $filename = $file . '_lang.php';
369. $dest_loc = $dest_dir . $filename;
370.
371. $str = '<?php' . "\n" . '$lang = array(' . "\n\n\n";
372.
373. ee()->lang->loadfile($file);
374.
375. foreach ($_POST as $key => $val) {
376. $val = str_replace('<script', '', $val);
377. $val = str_replace('<iframe', '', $val);
378. $val = str_replace(array("\\", "'"), array("\\\\",
"\'"), $val);
379.
380. $str .= '\'' . $key . '\' => ' . "\n" . '\'' . $val
. '\'' . ",\n\n";
381. }
382.
383. $str .= "''=>''\n);\n\n";
384. $str .= "// End of File";

[...]

400. $this->load->helper('file');
401.
402. if (write_file($dest_loc, $str)) {
403. ee('CP/Alert')->makeInline('shared-form')
404. ->asSuccess()
405. ->withTitle(lang('translations_saved'))
406. ->addToBody(sprintf(lang('file_saved'),
$dest_loc))
407. ->defer();

User input passed via keys of POST parameters is not properly sanitized
before being assigned
to the "$str" variable at line 380. Such a variable will be used in a
call to the "write_file()"
function at line 402, trying to write user supplied content into the
/system/user/language/[lang]/[file]_lang.php file. This can be exploited
to inject and execute arbitrary PHP code. Successful exploitation of
this vulnerability requires an account with
permissions to access the CP translation system utilities.


[-] Solution:

Upgrade to version 6.0.3, 5.4.2, or later.


[-] Disclosure Timeline:

[03/02/2021] - Vendor notified through HackerOne
[15/02/2021] - Vulnerability acknowledged by the vendor
[16/02/2021] - CVE number assigned
[17/02/2021] - Version 6.0.3 released
[04/03/2021] - Version 5.4.2 released
[15/03/2021] - Public disclosure


[-] CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org)
has assigned the name CVE-2021-27230 to this vulnerability.


[-] Credits:

Vulnerability discovered by Egidio Romano.


[-] Other References:

https://hackerone.com/reports/1093444


[-] Original Advisory:

http://karmainsecurity.com/KIS-2021-03
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close