SlideShare a Scribd company logo
1 of 32
Download to read offline
General Method of HTTP Messages Authentication Based on Hash Functions in Web Applications 
Denis Kolegov 
Tomsk State University 
Information Security and Cryptography Department 
SEPTEMBER 8 - 13 
EKATERINBURG 
2014
Introduction 
•HTTP doesn’t have built in message authentication mechanisms 
•HTTP messages authentication for web forms 
–Origin authenticity 
–Parameter names and values integrity 
–Workflow integrity 
•OWASP Top 10 2013 
–A4 Insecure Direct Object Reference 
–A7 Missing Function Level Access Control 
–A8 Cross-Site Request Forgery (CSRF) 
•Advanced Features 
–Attack surface reduction 
–Protection against automated attacks 
2
Example 1 – CSRF Attack 
3 
•Protection methods 
–Synchronizer token pattern 
–Double submit cookies 
–Encrypted token pattern 
–Header-based (Referer, X-Requested-With, custom headers) 
–Origin header 
•Attacks 
–Token leakage 
–Token prediction 
–Token retrieving (e.g., BREACH attack) 
–Cookie injection
Example 2 – CSRF Token Leakage 
•<BASE> jumping attack 
<base href="http://evil.com/"> ← Injection point 
<form action="create_folder"> 
<input type="hidden" name="csrf_token" value="21312">… 
</form> 
•Malicious request 
http://evil.com/create_folder?csrf_token=21312 
•Stolen CSRF token can be used by an attacker in different context 
http://example.com/admin/delete_account?csrf_token=21312 
4
Example 3 – CSRF Token Leakage 
•POST request based on location.hash value is used to download content from example.com/#/mypage 
example.com/#/evil.com ← Injection point 
•Malicious request 
POST http://evil.com/get_content 
Host: evil.com 
rn 
csrf_token=21312 
•Stolen CSRF token can be used by an attacker in different context 
http://example.com/admin/delete_account.php?csrf_token=21312 
5
Example 4 – CSRF Token Leakage 
•Content from http://example.com includes the following form 
<form action="$_SERVER['REFERER_URI']"> ← Injection point 
<input type="hidden" name="csrf_token" value="21312">… 
</form> 
•http://site.com//evil.com/../search corresponds to the following form 
<form action="//evil.com/../search"> 
<input type="hidden" name="csrf_token" value="21312">… 
</form> 
•Malicious request 
http://evil.com/../search?csrf_token=21312 
•Stolen CSRF token can be used by an attacker in different context 
http://example.com/admin/delete_account.php?csrf_token=21312 
6
Example 5 – Parameter Pollution 
•Supplying multiple HTTP parameters with the same name may cause an application to interpret values in unanticipated ways 
/index.aspx?page=select 1,2,3 from table ← SQL-injection is detected 
/index.aspx?page=select 1&page=2,3 from table 
•Different web technologies manage multiple occurrences of the same parameter in different ways 
7
Example 6 – BREACH attack against CSRF Token 
•Attackers could figure out CSRF token even when the communication was encrypted 
•CSRF Tokens must be unique per request if HTTP Response compression is used 
•Facebook tokens 
–CSRF_Token = SHA2(accound_id, current_date, random_salt) 
•Links 
–https://blog.whitehatsec.com/raising-the-csrf-bar/ 
–https://www.facebook.com/notes/protect-the-graph/preventing-a-breach- attack/1455331811373632 
8
Example 7 - Insecure Direct Object Reference 
9
Example 8 - Insecure Direct Object Reference 
10
Causes and Consequences 
11 
Vulnerability 
Attack 
Weakness 
Threat 
Insecurity 
Risk 
Unsafety
Known Approaches 
•CSRF-tokens 
–Encryption-based 
–HMAC-based 
•Authenticated HTTP requests 
–RFC 6749 «The OAuth 1.0 Protocol» 
•«Signed requests» API (Yahoo, Amazon, Facebook, Twitter) 
•WAF 
–ModSecurity: HMAC Token Protection 
–F5 Networks ASM: Dynamic Content Value 
•Frameworks 
–ASP.NET Event Validation, View State MAC 
12
Limitations of Known Approaches 
•As a rule, web applications are protected from attacks against authenticity origin (e.g., CSRF attack) 
•HTTP messages authentication mechanisms are implemented in special protocols, API or WAFs 
•Client-side generated data and input fields are out of scope 
•Protocols should consider HTTP protocol features and influence of session management and load balancing mechanisms 
•Workflow protection is not implemented in known frameworks 
13
Authenticator Base String 
•Authenticator base string (ABS) is a normalized string, calculated from object’s and subject’s attributes according to security policy 
•The ABS includes the following elements of the HTTP request 
–Parameter names and values 
–User’s identifiers (session cookie mandatory should be there) 
–Resource’s identifier (URI) 
–HTTP request method 
–HTTP custom headers 
•Encoding and delimiters 
–BASE64, HEX 
–Special characters (# & ; =) 
14
Web Form Parameters 
•Controlled by name 
–An attacker can’t change parameter names that were set by server in HTTP response 
•Controlled by value 
–An attacker can’t change parameter values that were set by server in HTTP response 
•Validated 
–Client-side generated data 
–User’s input fields 
15
Base Validation Protocol 
•We want to validate user’s input using HMAC and authenticator string 
•Protocol parameters 
–A – alphabet of permitted input characters (e.g., 0,1,…,9) 
–U – union operation 
–w – user’s input 
–S(w) – set of word w characters 
–L(A) – string of ordered elements of set A 
–k – secret key 
•Protocol actions 
–Client ← Server: response, containing web form with input field and hidden field with mac = HMAC(k, L(A)) value 
–Client → Server: request with mac and w parameters 
–Server: if HMAC(k, L(A U S(w)) = mac then request is permitted 
16
•ABS is constructed by concatenating the following HTTP request elements according to security policy 
auth = 
ordered list of parameter names + ";" + 
ordered list of pairs (parameter name = value or #) + ";" + 
user’s identifier + ";" + 
resource’s identifier + ";" + 
HTTP method 
String Construction 
17
1.Create L = {p1, …, pm} ordered list of parameter name-value pairs of object request 
2. If parameters are controlled by name then 
auth = name(p1)+ "&" + … + "&" + name(pm) + ";" 
3. For each p from L 
if p is controlled then auth = auth + name(p) + "=" + value(p) + "&“ 
if p is validated then auth = auth + name(p) + "=#&" 
4. Add identification data of user and resource, and the HTTP method 
auth = auth + "; " + IDs + ";" + IDr + ";" + op 
Construction Method 
18
Sessionless Protocol 
•Parameters 
–k – server’s master key 
–kr – server’s one-time random key 
–IDr – resource's identifier 
–IDs – user’s identifier 
–LP – security policy expressed in a specific language 
–time – timestamp 
–E – encryption function, h – hash function 
•All servers share the same master key and there are no data in session 
•Protocol actions 
–Client → Server: initial request from user (IDs) to resource (IDr) 
–Client ← Server: response , containing access attributes mac = h(kr, auth, time) and Ek(LP , time, kr) 
–Client → Server: final request with IDs’, IDr’, mac’, Ek(LP, time, kr) 
19
Sessionful Protocol 
•Parameters 
–k – server’s key 
–IDr – resource's identifier 
–IDs – user’s identifier 
–LP – security policy expressed in a specific language 
–time – timestamp 
–E – encryption function, h – hash function 
•Session data 
–k, time and LP are stored in user’s session 
•Protocol actions 
–Client → Server: initial request from user (IDs) to resource (IDr) 
–Client ← Server: response, containing access attributes mac = h(k, auth, time) 
–Client → Server: final request with IDs’, IDr’, mac’ 
20
ABAC 
21
•ABAC can be configured to implement DAC, MAC, or RBAC (Jin, Krishnan, Sandhu, 2012) 
•Attribute is a property expressed as a name:value pair associated with any entity in the system 
•The proposed method of HTTP messages authentication can be expressed in terms of ABAC model 
•All this creates the prerequisites for unified access control mechanism in web applications 
ABAC properties 
22
•Elements of model 
–Operations – the HTTP methods (GET, POST, PUT, etc) 
–Objects – URIs 
–Object attributes – permitted parameters for access to object 
–Subject – HTTP request to objects 
–Subject attributes – HTTP request parameters and headers 
•Access rule 
–Subject can access object if and only if authenticator calculated from object’s attributes is equal to authenticator calculated from subject’s attributes 
Formal Description in ABAC 
23
The Control of Workflow Integrity 
24 
•We are currently researching if it possible to develop workflow protection mechanisms in the context of proposed method 
•Proposed HTTP messages authentication method makes some attacks against workflow impossible 
•Another enhancement of the method is adding a current state and sequence of permitted sates in the policy stored on a client-side in the encrypted form
Proof of Concept 
•Django Framework 
•Web forms strict security 
•Project 
–https://github.com/tsu-iscd/django-HTTPauth 
•Modes 
–Sessionless 
–Sessionful 
25
Features 
•Strict protection against CSRF attack 
•CSRF-tokens protection 
–time to live – protection against replay attacks 
–randomization – protection against BREACH-like attacks 
–context – protection against leakage 
•Integrity control of parameter names and values 
•Parameter values validation in a given alphabet 
•Support configuration without persistent and sharing sessions 
26
Policy Description 
auth_policy = { 
“object”: URI regular expression, 
“subject”: session identifier name, 
“name_protection”: True | False, 
“replay_protection”: { 
“enable”: True | False, 
“interval”: value}, 
“parameter_protection”: { 
parameter_name: { 
“action”: “control” | “validate” 
“value”: regular expression }, …, } 
} 
27
Policy Example 
class ClientForm(forms.Form): 
product = forms.CharField(initial='Test') 
price = forms.IntegerField() 
policy = {'object':'http://127.0.0.1:8000/add/', 
'name_protection' : False, 
'replay_protection': { 
'enable':True, 
'interval':'30' }, 
'parameter_protection': { 
‘product': { 
'action':'validate', 
'value':'[A-Za-z]+'}, 
'price': { 
'action':'control'}}} 
28
Application Example 
29
Conclusion 
•HTTP messages authentication ABAC model is developed 
•General HTTP authentication method allowing to control and to validate client-side generated data is proposed 
•Authentication protocol adapted to employment in web applications is designed 
–Proposed approach can be employ in configurations without sharing or persistent sessions support 
–Protocol data can be stored on server-side and client-side 
•PoC have been implemented in Django framework 
30
Bibliography 
•Vladimir Kochetkov. How to Develop a Secure Web Application and Stay in Mind? URL: http://www.slideshare.net/kochetkov.vladimir/how- to-develop-a-secure-web-application-and-stay-in-mind-phdays-3 
•Jim Monico, Eoin Keary. Form Processing and Workflows. URL: http://secappdev.org/handouts/2014/Jim%20Manico/HTML%20Forms%20and%20Workflows%20v3.pdf 
•Sergey Bobrov. Web Application Attacks via Request-URI. URL: http://xakep.ru/issue/xa-171/ 
•TrustWave’s SpiderLabs. HMAC Token Protection. URL: http://blog.spiderlabs.com/2014/01/modsecurity-advanced-topic-of- the-week-hmac-token-protection.html 
31
32 
Denis Kolegov 
E-mail: dnkolegov@gmail.com 
Twitter: @dnkolegov

More Related Content

What's hot

Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary Attacks
NetSPI
 

What's hot (20)

A Novel methodology for handling Document Level Security in Search Based Appl...
A Novel methodology for handling Document Level Security in Search Based Appl...A Novel methodology for handling Document Level Security in Search Based Appl...
A Novel methodology for handling Document Level Security in Search Based Appl...
 
Html5 hacking
Html5 hackingHtml5 hacking
Html5 hacking
 
Crawl
CrawlCrawl
Crawl
 
Meeting 4 : proxy
Meeting 4 : proxyMeeting 4 : proxy
Meeting 4 : proxy
 
Jose Selvi - Side-Channels Uncovered [rootedvlc2018]
Jose Selvi - Side-Channels Uncovered [rootedvlc2018]Jose Selvi - Side-Channels Uncovered [rootedvlc2018]
Jose Selvi - Side-Channels Uncovered [rootedvlc2018]
 
Big problems with big data – Hadoop interfaces security
Big problems with big data – Hadoop interfaces securityBig problems with big data – Hadoop interfaces security
Big problems with big data – Hadoop interfaces security
 
Introduction to Windows Dictionary Attacks
Introduction to Windows Dictionary AttacksIntroduction to Windows Dictionary Attacks
Introduction to Windows Dictionary Attacks
 
CNIT 124: Ch 9: Password Attacks
CNIT 124: Ch 9: Password AttacksCNIT 124: Ch 9: Password Attacks
CNIT 124: Ch 9: Password Attacks
 
Injection flaw teaser
Injection flaw teaserInjection flaw teaser
Injection flaw teaser
 
External to DA, the OS X Way
External to DA, the OS X WayExternal to DA, the OS X Way
External to DA, the OS X Way
 
BSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad GuysBSIDES-PR Keynote Hunting for Bad Guys
BSIDES-PR Keynote Hunting for Bad Guys
 
Web security for developers
Web security for developersWeb security for developers
Web security for developers
 
Death of WAF - GoSec '15
Death of WAF - GoSec '15Death of WAF - GoSec '15
Death of WAF - GoSec '15
 
Death of Web App Firewall
Death of Web App FirewallDeath of Web App Firewall
Death of Web App Firewall
 
CNIT 124: Ch 7: Capturing Traffic
CNIT 124: Ch 7: Capturing TrafficCNIT 124: Ch 7: Capturing Traffic
CNIT 124: Ch 7: Capturing Traffic
 
CNIT 121: 14 Investigating Applications
CNIT 121: 14 Investigating ApplicationsCNIT 121: 14 Investigating Applications
CNIT 121: 14 Investigating Applications
 
Carlos García - Pentesting Active Directory Forests [rooted2019]
Carlos García - Pentesting Active Directory Forests [rooted2019]Carlos García - Pentesting Active Directory Forests [rooted2019]
Carlos García - Pentesting Active Directory Forests [rooted2019]
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
Addios!
Addios!Addios!
Addios!
 
BSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathersBSides_Charm2015_Info sec hunters_gathers
BSides_Charm2015_Info sec hunters_gathers
 

Viewers also liked

9 Ways to Hack a Web App
9 Ways to Hack a Web App9 Ways to Hack a Web App
9 Ways to Hack a Web App
elliando dias
 
Общая модель аутентификации HTTP-сообщений на основе хэш- функций в веб-прил...
Общая модель аутентификации  HTTP-сообщений на основе хэш- функций в веб-прил...Общая модель аутентификации  HTTP-сообщений на основе хэш- функций в веб-прил...
Общая модель аутентификации HTTP-сообщений на основе хэш- функций в веб-прил...
Positive Hack Days
 
Authentication: Cookies vs JWTs and why you’re doing it wrong
Authentication: Cookies vs JWTs and why you’re doing it wrongAuthentication: Cookies vs JWTs and why you’re doing it wrong
Authentication: Cookies vs JWTs and why you’re doing it wrong
Derek Perkins
 

Viewers also liked (12)

9 Ways to Hack a Web App
9 Ways to Hack a Web App9 Ways to Hack a Web App
9 Ways to Hack a Web App
 
Общая модель аутентификации HTTP-сообщений на основе хэш- функций в веб-прил...
Общая модель аутентификации  HTTP-сообщений на основе хэш- функций в веб-прил...Общая модель аутентификации  HTTP-сообщений на основе хэш- функций в веб-прил...
Общая модель аутентификации HTTP-сообщений на основе хэш- функций в веб-прил...
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Rest API Security
Rest API SecurityRest API Security
Rest API Security
 
Http Vs Https .
Http Vs Https . Http Vs Https .
Http Vs Https .
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Introduction to HTTP protocol
Introduction to HTTP protocolIntroduction to HTTP protocol
Introduction to HTTP protocol
 
Authentication: Cookies vs JWTs and why you’re doing it wrong
Authentication: Cookies vs JWTs and why you’re doing it wrongAuthentication: Cookies vs JWTs and why you’re doing it wrong
Authentication: Cookies vs JWTs and why you’re doing it wrong
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 
Ip Sec
Ip SecIp Sec
Ip Sec
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
 
Secure Your REST API (The Right Way)
Secure Your REST API (The Right Way)Secure Your REST API (The Right Way)
Secure Your REST API (The Right Way)
 

Similar to General Method of HTTP Messages Authentication Based on Hash Functions in Web Applications

Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert02 banking trojans-thomassiebert
02 banking trojans-thomassiebert
geeksec80
 
Wakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
Wakanda and the top 5 security risks - JS.everyrwhere(2012) EuropeWakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
Wakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
Alexandre Morgaut
 

Similar to General Method of HTTP Messages Authentication Based on Hash Functions in Web Applications (20)

HTML5 hacking
HTML5 hackingHTML5 hacking
HTML5 hacking
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
Evolution of the REST API
Evolution of the REST APIEvolution of the REST API
Evolution of the REST API
 
Using & Abusing APIs: An Examination of the API Attack Surface
Using & Abusing APIs: An Examination of the API Attack SurfaceUsing & Abusing APIs: An Examination of the API Attack Surface
Using & Abusing APIs: An Examination of the API Attack Surface
 
The path of secure software by Katy Anton
The path of secure software by Katy AntonThe path of secure software by Katy Anton
The path of secure software by Katy Anton
 
Introduction to Web Application Security Principles
Introduction to Web Application Security Principles Introduction to Web Application Security Principles
Introduction to Web Application Security Principles
 
Web Exploitation Security
Web Exploitation SecurityWeb Exploitation Security
Web Exploitation Security
 
REST APIs
REST APIsREST APIs
REST APIs
 
Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2
 
Evolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser SecurityEvolution Of The Web Platform & Browser Security
Evolution Of The Web Platform & Browser Security
 
Romulus OWASP
Romulus OWASPRomulus OWASP
Romulus OWASP
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert02 banking trojans-thomassiebert
02 banking trojans-thomassiebert
 
REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!
 
Basics of the Web Platform
Basics of the Web PlatformBasics of the Web Platform
Basics of the Web Platform
 
Wakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
Wakanda and the top 5 security risks - JS.everyrwhere(2012) EuropeWakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
Wakanda and the top 5 security risks - JS.everyrwhere(2012) Europe
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
Maximizer 2018 API training
Maximizer 2018 API trainingMaximizer 2018 API training
Maximizer 2018 API training
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
 
Attques web
Attques webAttques web
Attques web
 

More from Denis Kolegov

Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
Denis Kolegov
 
Моделирование безопасности управления доступом и информационными потоками на ...
Моделирование безопасности управления доступом и информационными потоками на ...Моделирование безопасности управления доступом и информационными потоками на ...
Моделирование безопасности управления доступом и информационными потоками на ...
Denis Kolegov
 
Development and Implementation of Mandatory Access Control Policy for RDBMS M...
Development and Implementation of Mandatory Access Control Policy for RDBMS M...Development and Implementation of Mandatory Access Control Policy for RDBMS M...
Development and Implementation of Mandatory Access Control Policy for RDBMS M...
Denis Kolegov
 
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
Denis Kolegov
 
О построении иерархического ролевого управления доступом (SibeCrypt 2012)
О построении иерархического ролевого управления доступом (SibeCrypt 2012)О построении иерархического ролевого управления доступом (SibeCrypt 2012)
О построении иерархического ролевого управления доступом (SibeCrypt 2012)
Denis Kolegov
 
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
Denis Kolegov
 

More from Denis Kolegov (14)

Database Firewall from Scratch
Database Firewall from ScratchDatabase Firewall from Scratch
Database Firewall from Scratch
 
F5 BIG-IP Misconfigurations
F5 BIG-IP MisconfigurationsF5 BIG-IP Misconfigurations
F5 BIG-IP Misconfigurations
 
SibirCTF 2016. Практические методы защиты веб-приложений
SibirCTF 2016. Практические методы защиты веб-приложенийSibirCTF 2016. Практические методы защиты веб-приложений
SibirCTF 2016. Практические методы защиты веб-приложений
 
SibeCrypt 2016. Практические методы защиты веб-приложений
SibeCrypt 2016. Практические методы защиты веб-приложенийSibeCrypt 2016. Практические методы защиты веб-приложений
SibeCrypt 2016. Практические методы защиты веб-приложений
 
ZN27112015
ZN27112015ZN27112015
ZN27112015
 
Covert Timing Channels based on HTTP Cache Headers (Special Edition for Top 1...
Covert Timing Channels based on HTTP Cache Headers (Special Edition for Top 1...Covert Timing Channels based on HTTP Cache Headers (Special Edition for Top 1...
Covert Timing Channels based on HTTP Cache Headers (Special Edition for Top 1...
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache Headers
 
Covert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache HeadersCovert Timing Channels using HTTP Cache Headers
Covert Timing Channels using HTTP Cache Headers
 
Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
Общая модель аутентификации HTTP-сообщений на основе хэш-функций в веб-прилож...
 
Моделирование безопасности управления доступом и информационными потоками на ...
Моделирование безопасности управления доступом и информационными потоками на ...Моделирование безопасности управления доступом и информационными потоками на ...
Моделирование безопасности управления доступом и информационными потоками на ...
 
Development and Implementation of Mandatory Access Control Policy for RDBMS M...
Development and Implementation of Mandatory Access Control Policy for RDBMS M...Development and Implementation of Mandatory Access Control Policy for RDBMS M...
Development and Implementation of Mandatory Access Control Policy for RDBMS M...
 
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
Разработка и реализация мандатного механизма управления доступом в СУБД MySQL...
 
О построении иерархического ролевого управления доступом (SibeCrypt 2012)
О построении иерархического ролевого управления доступом (SibeCrypt 2012)О построении иерархического ролевого управления доступом (SibeCrypt 2012)
О построении иерархического ролевого управления доступом (SibeCrypt 2012)
 
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
Разработка и реализация механизма мандатного управления доступом в СУБД MySQL...
 

Recently uploaded

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

General Method of HTTP Messages Authentication Based on Hash Functions in Web Applications

  • 1. General Method of HTTP Messages Authentication Based on Hash Functions in Web Applications Denis Kolegov Tomsk State University Information Security and Cryptography Department SEPTEMBER 8 - 13 EKATERINBURG 2014
  • 2. Introduction •HTTP doesn’t have built in message authentication mechanisms •HTTP messages authentication for web forms –Origin authenticity –Parameter names and values integrity –Workflow integrity •OWASP Top 10 2013 –A4 Insecure Direct Object Reference –A7 Missing Function Level Access Control –A8 Cross-Site Request Forgery (CSRF) •Advanced Features –Attack surface reduction –Protection against automated attacks 2
  • 3. Example 1 – CSRF Attack 3 •Protection methods –Synchronizer token pattern –Double submit cookies –Encrypted token pattern –Header-based (Referer, X-Requested-With, custom headers) –Origin header •Attacks –Token leakage –Token prediction –Token retrieving (e.g., BREACH attack) –Cookie injection
  • 4. Example 2 – CSRF Token Leakage •<BASE> jumping attack <base href="http://evil.com/"> ← Injection point <form action="create_folder"> <input type="hidden" name="csrf_token" value="21312">… </form> •Malicious request http://evil.com/create_folder?csrf_token=21312 •Stolen CSRF token can be used by an attacker in different context http://example.com/admin/delete_account?csrf_token=21312 4
  • 5. Example 3 – CSRF Token Leakage •POST request based on location.hash value is used to download content from example.com/#/mypage example.com/#/evil.com ← Injection point •Malicious request POST http://evil.com/get_content Host: evil.com rn csrf_token=21312 •Stolen CSRF token can be used by an attacker in different context http://example.com/admin/delete_account.php?csrf_token=21312 5
  • 6. Example 4 – CSRF Token Leakage •Content from http://example.com includes the following form <form action="$_SERVER['REFERER_URI']"> ← Injection point <input type="hidden" name="csrf_token" value="21312">… </form> •http://site.com//evil.com/../search corresponds to the following form <form action="//evil.com/../search"> <input type="hidden" name="csrf_token" value="21312">… </form> •Malicious request http://evil.com/../search?csrf_token=21312 •Stolen CSRF token can be used by an attacker in different context http://example.com/admin/delete_account.php?csrf_token=21312 6
  • 7. Example 5 – Parameter Pollution •Supplying multiple HTTP parameters with the same name may cause an application to interpret values in unanticipated ways /index.aspx?page=select 1,2,3 from table ← SQL-injection is detected /index.aspx?page=select 1&page=2,3 from table •Different web technologies manage multiple occurrences of the same parameter in different ways 7
  • 8. Example 6 – BREACH attack against CSRF Token •Attackers could figure out CSRF token even when the communication was encrypted •CSRF Tokens must be unique per request if HTTP Response compression is used •Facebook tokens –CSRF_Token = SHA2(accound_id, current_date, random_salt) •Links –https://blog.whitehatsec.com/raising-the-csrf-bar/ –https://www.facebook.com/notes/protect-the-graph/preventing-a-breach- attack/1455331811373632 8
  • 9. Example 7 - Insecure Direct Object Reference 9
  • 10. Example 8 - Insecure Direct Object Reference 10
  • 11. Causes and Consequences 11 Vulnerability Attack Weakness Threat Insecurity Risk Unsafety
  • 12. Known Approaches •CSRF-tokens –Encryption-based –HMAC-based •Authenticated HTTP requests –RFC 6749 «The OAuth 1.0 Protocol» •«Signed requests» API (Yahoo, Amazon, Facebook, Twitter) •WAF –ModSecurity: HMAC Token Protection –F5 Networks ASM: Dynamic Content Value •Frameworks –ASP.NET Event Validation, View State MAC 12
  • 13. Limitations of Known Approaches •As a rule, web applications are protected from attacks against authenticity origin (e.g., CSRF attack) •HTTP messages authentication mechanisms are implemented in special protocols, API or WAFs •Client-side generated data and input fields are out of scope •Protocols should consider HTTP protocol features and influence of session management and load balancing mechanisms •Workflow protection is not implemented in known frameworks 13
  • 14. Authenticator Base String •Authenticator base string (ABS) is a normalized string, calculated from object’s and subject’s attributes according to security policy •The ABS includes the following elements of the HTTP request –Parameter names and values –User’s identifiers (session cookie mandatory should be there) –Resource’s identifier (URI) –HTTP request method –HTTP custom headers •Encoding and delimiters –BASE64, HEX –Special characters (# & ; =) 14
  • 15. Web Form Parameters •Controlled by name –An attacker can’t change parameter names that were set by server in HTTP response •Controlled by value –An attacker can’t change parameter values that were set by server in HTTP response •Validated –Client-side generated data –User’s input fields 15
  • 16. Base Validation Protocol •We want to validate user’s input using HMAC and authenticator string •Protocol parameters –A – alphabet of permitted input characters (e.g., 0,1,…,9) –U – union operation –w – user’s input –S(w) – set of word w characters –L(A) – string of ordered elements of set A –k – secret key •Protocol actions –Client ← Server: response, containing web form with input field and hidden field with mac = HMAC(k, L(A)) value –Client → Server: request with mac and w parameters –Server: if HMAC(k, L(A U S(w)) = mac then request is permitted 16
  • 17. •ABS is constructed by concatenating the following HTTP request elements according to security policy auth = ordered list of parameter names + ";" + ordered list of pairs (parameter name = value or #) + ";" + user’s identifier + ";" + resource’s identifier + ";" + HTTP method String Construction 17
  • 18. 1.Create L = {p1, …, pm} ordered list of parameter name-value pairs of object request 2. If parameters are controlled by name then auth = name(p1)+ "&" + … + "&" + name(pm) + ";" 3. For each p from L if p is controlled then auth = auth + name(p) + "=" + value(p) + "&“ if p is validated then auth = auth + name(p) + "=#&" 4. Add identification data of user and resource, and the HTTP method auth = auth + "; " + IDs + ";" + IDr + ";" + op Construction Method 18
  • 19. Sessionless Protocol •Parameters –k – server’s master key –kr – server’s one-time random key –IDr – resource's identifier –IDs – user’s identifier –LP – security policy expressed in a specific language –time – timestamp –E – encryption function, h – hash function •All servers share the same master key and there are no data in session •Protocol actions –Client → Server: initial request from user (IDs) to resource (IDr) –Client ← Server: response , containing access attributes mac = h(kr, auth, time) and Ek(LP , time, kr) –Client → Server: final request with IDs’, IDr’, mac’, Ek(LP, time, kr) 19
  • 20. Sessionful Protocol •Parameters –k – server’s key –IDr – resource's identifier –IDs – user’s identifier –LP – security policy expressed in a specific language –time – timestamp –E – encryption function, h – hash function •Session data –k, time and LP are stored in user’s session •Protocol actions –Client → Server: initial request from user (IDs) to resource (IDr) –Client ← Server: response, containing access attributes mac = h(k, auth, time) –Client → Server: final request with IDs’, IDr’, mac’ 20
  • 22. •ABAC can be configured to implement DAC, MAC, or RBAC (Jin, Krishnan, Sandhu, 2012) •Attribute is a property expressed as a name:value pair associated with any entity in the system •The proposed method of HTTP messages authentication can be expressed in terms of ABAC model •All this creates the prerequisites for unified access control mechanism in web applications ABAC properties 22
  • 23. •Elements of model –Operations – the HTTP methods (GET, POST, PUT, etc) –Objects – URIs –Object attributes – permitted parameters for access to object –Subject – HTTP request to objects –Subject attributes – HTTP request parameters and headers •Access rule –Subject can access object if and only if authenticator calculated from object’s attributes is equal to authenticator calculated from subject’s attributes Formal Description in ABAC 23
  • 24. The Control of Workflow Integrity 24 •We are currently researching if it possible to develop workflow protection mechanisms in the context of proposed method •Proposed HTTP messages authentication method makes some attacks against workflow impossible •Another enhancement of the method is adding a current state and sequence of permitted sates in the policy stored on a client-side in the encrypted form
  • 25. Proof of Concept •Django Framework •Web forms strict security •Project –https://github.com/tsu-iscd/django-HTTPauth •Modes –Sessionless –Sessionful 25
  • 26. Features •Strict protection against CSRF attack •CSRF-tokens protection –time to live – protection against replay attacks –randomization – protection against BREACH-like attacks –context – protection against leakage •Integrity control of parameter names and values •Parameter values validation in a given alphabet •Support configuration without persistent and sharing sessions 26
  • 27. Policy Description auth_policy = { “object”: URI regular expression, “subject”: session identifier name, “name_protection”: True | False, “replay_protection”: { “enable”: True | False, “interval”: value}, “parameter_protection”: { parameter_name: { “action”: “control” | “validate” “value”: regular expression }, …, } } 27
  • 28. Policy Example class ClientForm(forms.Form): product = forms.CharField(initial='Test') price = forms.IntegerField() policy = {'object':'http://127.0.0.1:8000/add/', 'name_protection' : False, 'replay_protection': { 'enable':True, 'interval':'30' }, 'parameter_protection': { ‘product': { 'action':'validate', 'value':'[A-Za-z]+'}, 'price': { 'action':'control'}}} 28
  • 30. Conclusion •HTTP messages authentication ABAC model is developed •General HTTP authentication method allowing to control and to validate client-side generated data is proposed •Authentication protocol adapted to employment in web applications is designed –Proposed approach can be employ in configurations without sharing or persistent sessions support –Protocol data can be stored on server-side and client-side •PoC have been implemented in Django framework 30
  • 31. Bibliography •Vladimir Kochetkov. How to Develop a Secure Web Application and Stay in Mind? URL: http://www.slideshare.net/kochetkov.vladimir/how- to-develop-a-secure-web-application-and-stay-in-mind-phdays-3 •Jim Monico, Eoin Keary. Form Processing and Workflows. URL: http://secappdev.org/handouts/2014/Jim%20Manico/HTML%20Forms%20and%20Workflows%20v3.pdf •Sergey Bobrov. Web Application Attacks via Request-URI. URL: http://xakep.ru/issue/xa-171/ •TrustWave’s SpiderLabs. HMAC Token Protection. URL: http://blog.spiderlabs.com/2014/01/modsecurity-advanced-topic-of- the-week-hmac-token-protection.html 31
  • 32. 32 Denis Kolegov E-mail: dnkolegov@gmail.com Twitter: @dnkolegov