"Acunetix Web Vulnerability Scanner"로 내 사이트를 스캔 할 때 매우 놀랐습니다. Programm은 xss 필터링으로 매개 변수를 사용할 때 페이지에 많은 xss 취약점을 표시합니다. 예를 들어 :Codeigniter xss 취약점 및 기타 보안 문제
URL encoded GET input state was set to " onmouseover=prompt(967567) bad="
The input is reflected inside a tag parameter between double quotes.
나는 결과가 비어있을 때 내가 404 에러를 보여 돈`t 때문에 (이 있어야한다)의 생각합니다. 전 세계 XSS 필터링 프로그램을 켤 때
$this->pagination->initialize($config);
$this->load->model('aircraft_model');
$data['type'] = $this->input->get('type', TRUE);
$data['year'] = $this->input->get('year', TRUE);
$data['state'] = $this->input->get('state', TRUE);
$type_param = array (
'type' => $this->input->get('type', TRUE),
);
$parameters = array(
'year' => $this->input->get('year', TRUE),
'state_id' => $this->input->get('state', TRUE),
);
foreach ($parameters as $key=>$val)
{
if(!$parameters[$key])
{
unset($parameters[$key]);
}
}
$data['aircraft'] = $this->aircraft_model->get_aircraft($config['per_page'], $this->uri->segment(3, 1),$parameters, $type_param);
$data['title'] = 'Самолеты | ';
$data['error'] = '';
if (empty($data['aircraft']))
{
$data['error'] = '<br /><div class="alert alert-info"><b>По таким критериям не найдено ниодного самолета</b></div>';
}
$name = 'aircraft';
$this->template->index_view($data, $name);
도 XSS 취약점을 발견 : 나는
내 컨트롤러 "요청이 비어 있습니다"와 같은 메시지를 보여줍니다. 어쩌면 가능한 xss 메시지가 false입니까?
또한 SQL 주입이 하나 있습니다.
Attack details:
Path Fragment input/was set to \
Error message found:
You have an error in your SQL syntax
SQL에 오류 :
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10, 10' at line 3
SELECT * FROM (`db_cyclopedia`) LIMIT -10, 10
제어기 : HTTP 매개 변수 오염과
$this->load->model('cyclopedia_model');
$this->load->library('pagination');
$config['use_page_numbers'] = TRUE;
[pagination config]
$config['suffix'] = '/?'.http_build_query(array('type' => $this->input->get('type', TRUE)), '', "&");
$config['base_url'] = base_url().'cyclopedia/page/';
$count_all = $this->cyclopedia_model->count_all($this->input->get('type', TRUE));
if (!empty($count_all)){
$config['total_rows'] = $count_all;
}
else
{
$config['total_rows'] = $this->db->count_all('cyclopedia');
}
$config['per_page'] = 10;
$config['first_url'] = base_url().'cyclopedia/page/1'.'/?'.http_build_query(array('type' => $this->input->get('type', TRUE)), '', "&");
$this->pagination->initialize($config);
$parameters = array(
'cyclopedia_cat_id' => $this->input->get('type', TRUE),
);
foreach ($parameters as $key=>$val)
{
if(!$parameters[$key])
{
unset($parameters[$key]);
}
}
$data['type'] = $this->input->get('type', TRUE);
$data['cyclopedia'] = $this->cyclopedia_model->get_cyclopedia($config['per_page'], $this->uri->segment(3, 1),$parameters);
$data['title'] = 'Энциклопедия | ';
if (empty($data['cyclopedia']))
{
show_404();
}
$name = 'cyclopedia';
$this->template->index_view($data, $name);
그리고 하나 약간의 문제 (매개 변수를 가져).
Attack details
URL encoded GET input state was set to &n954725=v953060
Parameter precedence: last occurrence
Affected link: /aircraft/grid/?type=&year=&state=&n954725=v953060
Affected parameter: type=
코드를 많이 죄송
하지만 첫번째 CodeIgniter는/프레임 워크 및 안전과의 첫 경험.
업데이트 : 때이 site.com/1에 CodeIgniter의 쇼 같은 사이트 URL :
An Error Was Encountered
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.
방법 쇼 (404) 대신에이 메시지를 만들기 위해?
$output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close;
하지만 자동화 된 검사 도구 :
$config['first_url'] = base_url().'cyclopedia/page/1'.'/?'.http_build_query(array('type' => $this->input->get('type', TRUE)), '', "&");
는 그 다음 Pagination.php 라이브러리에서이 라인은 적절한 HTML - 이스케이프없이 출력 페이지에 그것을 뱉어 :
일반적으로 CI 보안은 약합니다. XSS 필터링과 관련해서는 다소 의문의 여지가 있습니다. XSS는 출력 문제이며, 입력 문제처럼 취급합니다. 당신이 할 수있는 일은 정규식이나 그와 비슷한 것으로 각 입력 매개 변수를 검사하는 것입니다. '글로벌 XSS 확인'을 잊어 버리면 그렇게 할 수 없습니다. 패턴의 허용 가능한 모든 값을 허용합니다. 또한 SQL 또는 다른 언어로 주입하는 모든 것을 탈출해야합니다. –
@ patrick-savalle 당신이 쓴 것이 CodeIgniter를 의미합니까? (예인 경우 예를 들어 어떻게 보여줄 수 있습니까?) 정규 표현식으로 테스트하는 방법을 모르겠습니다. – Vitaliy