ITAS Team đã phát hiện lỗ hổng SQL Injection trong Microweber CMS. Thông qua lỗ hổng này, hacker có thể thực thi tùy ý các câu lệnh truy vấn SQL. Nguyên nhân của lỗ hổng là do dữ liệu đầu vào từ người dùng cung cấp không được lọc.
Các cá nhân và tổ chức đang sử dụng CMS này nên cập nhật bản vá mới nhất 0.95 vào ngày 12/11/2014.
Thông tin về lỗ hổng:
– Lỗ hổng: SQL injection
– Nhà sản xuất: Microweber – https://microweber.com/
– Download link: https://microweber.com/download (https://github.com/microweber/microweber)
– Phiên bản lỗi: Version 0.95 trước ngày 09/12/2014.
– Phiên bản sửa: Version 0.95 cập nhật ngày 11/12/2014
– CVE ID: CVE-2014-9464
– Phát hiện bởi: Phạm Kiên Cường – cuong.k.pham@itas.vn và ITAS Team
::VULNERABILITY DETAIL::
– Vulnerable file: microweber-master/src/Microweber/Category.php
– Vulnerable function: get_children($parent_id = 0, $type = false, $visible_on_frontend = false)
– Vulnerable parameter: $parent_id
– Vulnerable code:
public function get_children($parent_id = 0, $type = false, $visible_on_frontend = false)
{
$categories_id = intval($parent_id);
$cache_group = ‘categories/’ . $categories_id;
$table = $this->tables[‘categories’];
$db_t_content = $this->tables[‘content’];
if (isset($orderby) == false) {
$orderby = array();
//$orderby[0] = ‘updated_on’;
//$orderby[1] = ‘DESC’;
$orderby[0] = ‘position’;
$orderby[1] = ‘asc’;
}
if (intval($parent_id) == 0) {
return false;
}
$data = array();
$data[‘parent_id’] = $parent_id;
if ($type != FALSE) {
$data[‘data_type’] = $type;
} else {
$type = ‘category_item’;
$data[‘data_type’] = $type;
}
$cache_group = ‘categories/’ . $parent_id;
$q = ” SELECT id, parent_id FROM $table WHERE parent_id=$parent_id “;
$q_cache_id = __FUNCTION__ . crc32($q);
$save = $this->app->db->query($q, $q_cache_id, $cache_group);
if (empty($save)) {
return false;
}
$to_return = array();
if (is_array($save) and !empty($save)) {
foreach ($save as $item) {
$to_return[] = $item[‘id’];
}
}
$to_return = array_unique($to_return);
return $to_return;
}
– Fix code:
public function get_children($parent_id = 0, $type = false, $visible_on_frontend = false)
{
$categories_id = $parent_id =intval($parent_id);
$cache_group = ‘categories/’ . $categories_id;
$table = $this->tables[‘categories’];
$db_t_content = $this->tables[‘content’];
if (isset($orderby) == false) {
$orderby = array();
//$orderby[0] = ‘updated_on’;
//$orderby[1] = ‘DESC’;
$orderby[0] = ‘position’;
$orderby[1] = ‘asc’;
}
if (intval($parent_id) == 0) {
return false;
}
$data = array();
$data[‘parent_id’] = $parent_id;
if ($type != FALSE) {
$data[‘data_type’] = $type;
} else {
$type = ‘category_item’;
$data[‘data_type’] = $type;
}
$cache_group = ‘categories/’ . $parent_id;
$q = ” SELECT id, parent_id FROM $table WHERE parent_id=$parent_id “;
$q_cache_id = __FUNCTION__ . crc32($q);
$save = $this->app->db->query($q, $q_cache_id, $cache_group);
if (empty($save)) {
return false;
}
$to_return = array();
if (is_array($save) and !empty($save)) {
foreach ($save as $item) {
$to_return[] = $item[‘id’];
}
}
$to_return = array_unique($to_return);
return $to_return;
}
Công bố thông tin:
– 09/12/2014: Phát hiện lỗ hổng
– 10/12/2014: Thông báo cho nhà sản xuất
– 11/12/2014: Nhà sản xuất xác nhận
– 11/12/2014: Nhà sản xuất cập nhật bản vá
– 16/12/2014: ITAS Team công bố thông tin
Tham khảo:
– https://microweber.com/list-of-contributors
– http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-9464
– http://www.exploit-db.com/exploits/35720/