Phân tích CVE-2016-8869, CVE-2016-8870 trên Joomla.

DiepNV88

VIP Members
24/09/2013
369
1.552 bài viết
Phân tích CVE-2016-8869, CVE-2016-8870 trên Joomla.
Joomla là hệ quản trị nội dung mã nguồn mở miễn phí. Gần đây các nhà nghiên cứu đã phát hiện ra 2 lỗ hổng cho phép attacker có thể tạo ra các tài khoản mới trên hệ thống Joomla và tạo đặc quyền cho tài khoản đó.

Phiên bản Joomla 3.6.3 có khả năng bị khai thác sau đây chúng ta cùng phân tích 2 khả năng tấn công có thể tạo được tài khoản trên website Joomla dính lỗi.

Đầu tiên các bạn cần tìm file: components/com_users/controllers/registration.php trong mã nguồn phiên bản Joomla 3.6.3, Phiên bản này các bạn có thể down trên trang chủ hoặc seach tìm kiếm.
Hoặc có thể lấy ở link này: https://goo.gl/N2wP3h (link github)
Hàm đăng ký:
  • UsersControllerRegistration::register() function public function register()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_(‘JINVALID_TOKEN’));// If registration is disabled – Redirect to login page.
if (JComponentHelper::getParams(‘com_users’)->get(‘allowUserRegistration’) == 0)
{
$this->setRedirect(JRoute::_(‘index.php?option=com_users &view=login’, false));
return false;
}

$app = JFactory::getApplication();
$model = $this->getModel(‘Registration’, ‘UsersModel’);

// Get the user data.
$requestData = $this->input->post->get(‘jform’, array(), ‘array’);

// Validate the posted data.
$form = $model->getForm();


}


Thứ 2 ta kiểm tra file: components/com_users/controllers/user.php
  • UsersControllerUser::register() function
public function register()
{
JSession::checkToken(‘post’) or jexit(JText::_(‘JINVALID_TOKEN’));// Get the application
$app = JFactory::getApplication();// Get the form data.
$data = $this->input->post->get(‘user’, array(), ‘array’);
// Get the model and validate the data.
$model = $this->getModel(‘Registration’, ‘UsersModel’);

$form = $model->getForm();


}

So sánh 2 hàm UsersControllerRegistration::register() function và UsersControllerUser::register() function chúng ta thấy:

if (JComponentHelper::getParams(‘com_users’)->get(‘allowUserRegistration’) == 0)
{
$this->setRedirect(JRoute::_(‘index.php?option=com_users &view=login’, false));

return false;
}

Ý nghĩa hàm này là nếu login lỗi thì sẽ chuyển tới trang login. Nhưng chúng ta lại có thể sử dụng hàm UsersControllerUser::register() function để tạo tài khoản mới mà bỏ việc phát hiện trên. Đọc mã trong hàm UsersControllerUser::register() function ta có thể thấy một yêu cầu tạo ra vẫn vẫn có thể được sửa đổi như dưới đây để sử dụng sơ hở trong form đăng ký.

1. registration.register -> user.register
2. jform
[*]-> user
[*]
1489939952cve.png



Để vá lỗ hổng này các bạn cần update lên phiên bản Joomla 3.6.4

Nguồn: kali-linux.co
 
Mời các bạn tham gia Group WhiteHat để thảo luận và cập nhật tin tức an ninh mạng hàng ngày.
Lưu ý từ WhiteHat: Kiến thức an ninh mạng để phòng chống, không làm điều xấu. Luật pháp liên quan
Bên trên