亿邮电子邮件系统远程命令执行漏洞分析与复现

亿邮电子邮件系统远程命令执行漏洞分析与复现

漏洞分析

首先 代码全局搜索moni_detail
找到了一个em_controller_action_app_mailadmin_moni_detail.class.php 的文件。然后再进去搜索gragh

根据这个函数

  1. /**
  2. * 生成图像
  3. *
  4. * @return void
  5. */
  6. protected function _get_graph()
  7. {
  8. $cluster = $this->__request->get_request('cluster', '');
  9. $hostname = $this->__request->get_request('hostname', 'elephant110');
  10. $type = $this->__request->get_request('type', 'cpu_report');
  11. $date_type = $this->__request->get_request('date_type', 'hour');
  12. $date_value = $this->__request->get_request('date_value', '1');
  13. $columns = $this->__request->get_request('columns', 2);
  14. $size = $this->__request->get_request('size', 'small');
  15. require_once PATH_EYOUM_LIB . 'em_monitor.class.php';
  16. $graph = new em_monitor;
  17. $condition = em_condition::factory('monitor', 'report:get_report');
  18. $condition->set_clustername($cluster);
  19. $condition->set_hostname($hostname);
  20. // 默认图形
  21. switch ($type) {
  22. case 'cpu_report':
  23. case 'mem_report':
  24. case 'network_report':
  25. case 'packet_report':
  26. case 'load_report':
  27. $condition->set_graph($type);
  28. break;
  29. // metric 图形
  30. default:
  31. $condition->set_graph('metric');
  32. $condition->set_metricname($type);
  33. break;
  34. }
  35. $size_array = $this->_get_recover_size($type);
  36. $graph->set_graph_size($size_array);
  37. $condition->set_size($size);
  38. $start = em_monitor::get_start_timestamp($date_value . ' ' . $date_type);
  39. $condition->set_start($start);
  40. $condition->set_end('now');
  41. $graph->set_graph($condition);
  42. $graph->set_debug(true);
  43. $graph->draw();
  44. }

最终执行到了draw这个函数。跟进draw函数

  1. /**
  2. * 画出 rrdtool 图形
  3. *
  4. * @return void
  5. * @throws em_monitor_exception
  6. */
  7. public function draw()
  8. {
  9. $command = implode(' ', $this->__graph);
  10. /*Make sure the image is not cached*/
  11. header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  12. header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
  13. header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  14. header ("Pragma: no-cache"); // HTTP/1.0
  15. if ($this->__debug) {
  16. $fp = fopen('/tmp/monitor.log', 'w');
  17. fwrite($fp, $command . "\n");
  18. fclose($fp);
  19. }
  20. header ("Content-type: image/gif");
  21. passthru($command);
  22. }

这里通过了passthru 接受参数来生成的。然后导致了一个命令执行的问题

0x02 漏洞复现

0x03 文章来源

文章转载于print('')博客,原文链接为:https://www.o2oxy.cn/3404.html

  • 发表于 2021-04-11 18:23:30
  • 阅读 ( 8707 )
  • 分类:漏洞分析

0 条评论

带头大哥
带头大哥

50 篇文章

站长统计