Web Logic Vulnerability
Web Logic Vulnerability
! Related Work
! Whitebox approach
! Detecting Logic Vulnerabilities in E-Commerce Applications
! Fangqi Sun, Liang Xu, Zhendong Su
! Blackbox approach
! Toward Black-box Detection of Logic Flaws in Web
Applications
! Giancarlo Pellegrino, Davide Balzarotti
Background and motivation
Logic Flaws
3
Logic Vulnerabilities
in E-Commerce Web Applications
! Third-party cashiers
! Bridge the trustiness gap between customers and merchants
Payment
! Logic vulnerabilities in e-commerce web applications status
! Abuse application-specific functionality
Consistent status?
! Allow attackers to purchase products or services
with incorrect or no payment
! Have multiple attack vectors Payment
Status
" Assumptions of user inputs and user actions should be
explicitly checked
! Example
" CVE-2009-2039 is reported for Luottokunta (v1.2) but the patched
Luottokunta (v1.3) is still vulnerable
Attack on Currency
Consistent status? NO
Payee is
merchantID = chocolateDelight
chocolateDelight
Consistent status? NO
Payee is
merchantID= attackerAlice
attackerAlice
Setting up a PayPal
merchant account
for Alice is easy
Related Work
Problem
Explicit Documentation
Yes No
Yes
White-box White-box
Source code
No
5
Problem
Explicit Documentation
Yes No
Yes
White-box White-box
Source code
Design verification
No
Design verification
6
Problem
Explicit Documentation
Yes No
Black-box Black-box
Yes
White-box White-box
Source code
Design verification
Black-box Black-box
No
Design verification
7
Comparing testing methods
! A symbolic execution
framework that explores spec,
ns, qs PHP ASTi IR
critical control flows Lexer
Constructor
& Parser
exhaustively
nj, Qj IRi
! Example
! Hidden HTML form element: md5($secret . $orderId . $orderTotal)
! $_GET['hash'] == md5($secret . $_GET['oId'] . $_GET['oTotal'])
Consistent status? NO
Should be
SecretMD5
R3 for order ID 1002: http://merchant.com/checkoutProcess.php? For1002
orderID=1001&LKMAC=SecretMD5For1001
Whitebox Approach
Evaluation and Results
Evaluation
! Subjects: 22 unique payment modules of
osCommerce
! More than 14,000 registered websites, 928 payment
modules, 13 years of history (osCommerce v2.3)
! 20 out of 46 default modules with distinct CFGs
! 2 Luottokunta payment modules (v1.2 & v1.3)
! Metrics
! Effectiveness:Detected 12 logic vulnerabilities (11 new)
with no false positives
! Performance
Logic Vulnerability Analysis Results
Payment Module Safe Payment Module Safe
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
2) Behavioral Patterns
r 1,1 r 1,2 r 1,3 r 1,4
Rp
r 1,3 r 1,3 St
r 2,1 r 2,2 r 2,3
PChain 1 r 1,2
TrWPrr
Data flow Workflow
1,2
r 1,4 1,4
r 2,2 r 2,2
r 1,3
Patterns I
r 1,1
r 2,1 F Patterns I
r 1,1
r 2,1 F
r 1,2
r 1,4
r 2,2
r 2,3 r 2,3
r 1,1
I r 2,1 F
TrWP
r 2,3 PChain 2 MWP
r 2,3
TrWP
MWP
9
Model Inference
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
2) Behavioral Patterns
r 1,1 r 1,2 r 1,3 r 1,4
Rp
r 1,3 r 1,3 St
r 2,1 r 2,2 r 2,3
PChain 1 r 1,2
TrWPrr
Data flow Workflow
1,2
r 1,4 1,4
r 2,2 r 2,2
r 1,3
Patterns I
r 1,1
r 2,1 F Patterns I
r 1,1
r 2,1 F
r 1,2
r 1,4
r 2,2
r 2,3 r 2,3
r 1,1
I r 2,1 F
TrWP
r 2,3 PChain 2 MWP
r 2,3
TrWP
MWP
10
Behavioral Patterns Extraction
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
2) Behavioral Patterns
r 1,1 r 1,2 r 1,3 r 1,4
Rp
r 1,3 r 1,3 St
r 2,1 r 2,2 r 2,3
PChain 1 r 1,2
TrWPrr
Data flow Workflow
1,2
r 1,4 1,4
r 2,2 r 2,2
r 1,3
Patterns I
r 1,1
r 2,1 F Patterns I
r 1,1
r 2,1 F
r 1,2
r 1,4
r 2,2
r 2,3 r 2,3
r 1,1
I r 2,1 F
TrWP
r 2,3 PChain 2 MWP
r 2,3
TrWP
MWP
11
Workflow Patterns
Traces: Model:
a
b
c
e f
12
Workflow Patterns
Traces: Model:
TrWP Rp a
b Rp
c
TrWP
TrWP Rp e f TrWP Rp
13
Data flow Patterns
Trace 1: Trace 2:
http://store.com/index.php http://store.com/index.php
<HTML> <HTML>
1
1
http://store.com/view.php?tok=8AFFB0 http://store.com/add.php?tok=DDA124
<HTML> <HTML>
2
2
http://store.com/add.php?tok=8AFFB0
<HTML>
3
14
Test Case Generation
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
2) Behavioral Patterns
r 1,1 r 1,2 r 1,3 r 1,4
Rp
r 1,3 r 1,3 St
r 2,1 r 2,2 r 2,3 Extraction PChain 1 r 1,2
TrWPrr
Data flow Workflow
1,2
r 1,4 1,4
r 2,2 r 2,2
r 1,3
Patterns I
r 1,1
r 2,1 F Patterns I
r 1,1
r 2,1 F
r 1,2
r 1,4
r 2,2
r 2,3 r 2,3
r 1,1
I r 2,1 F
TrWP
r 2,3 PChain 2 MWP
r 2,3
TrWP
MWP
15
Attack Pattern-based Test Case Generation
16
Attack Pattern-based Test Case Generation
17
Test Case Execution and Oracle
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
2) Behavioral Patterns
r 1,1 r 1,2 r 1,3 r 1,4
Rp
r 1,3 r 1,3 St
r 2,1 r 2,2 r 2,3
PChain 1 r 1,2
TrWPrr
Data flow Workflow
1,2
r 1,4 1,4
r 2,2 r 2,2
r 1,3
Patterns I
r 1,1
r 2,1 F Patterns I
r 1,1
r 2,1 F
r 1,2
r 1,4
r 2,2
r 2,3 r 2,3
r 1,1
I r 2,1 F
TrWP
r 2,3 PChain 2 MWP
r 2,3
TrWP
MWP
18
Test Case Execution and Oracle
1) Model Inference
r 1,3
r 1,2
r 1,1 r 1,2 r 1,3 r 1,4
74.125.230.240 > 192.168.1.89
Resource Resource r 1,4
r 2,2
192.168.1.89 > 74.125.230.240 Clustering I
r 1,1
F
74.125.230.240 > 192.168.1.89 Abstraction r 2,1 r 2,2 r 2,3
r 2,1
r 2,3
r 2,3
TrWP
MWP
19
Case Study: Shopping Cart Web Applications
Online Store
r der
O
Customers
Cashier-as-a-Service
Pa
y
Trace Collection
21
Blackbox Approach
Evaluation and Results
Experiments and Results
In total 3,145
test cases
22
Experiments and Results
In total 3,145
test cases
1,892 were
executed
23
Experiments and Results
24
Experiments and Results
25
Vulnerabilities
10 previously-unknown vulnerabilities
● Allowing to shop for free or pay less
AbanteCart x Notified
Notified Devel.
Devel.
Magento
Notified
Notified Devel.
OpenCart xx Devel.
osCommerce x x CVE-2012-2991
CVE-2012-2991
PrestaShop
TomatoCart x xx x CVE-2012-4934
CVE-2012-4934
CS-Cart x CVE-2013-0118
CVE-2013-0118
26
Conclusion
Developed a prototype
● assessed against 7 popular eCommerce web applications
28
Open Issues