Protecting a Moving Target: Addressing Web Application Concept Drift - - PowerPoint PPT Presentation

protecting a moving target addressing web application
SMART_READER_LITE
LIVE PREVIEW

Protecting a Moving Target: Addressing Web Application Concept Drift - - PowerPoint PPT Presentation

Protecting a Moving Target: Addressing Web Application Concept Drift The 12 th International Symposium on Recent Advances in Intrusion Detection 2009 Federico Maggi, William Robertson, Christopher Krgel, Giovanni Vigna Politecnico di Milano,


slide-1
SLIDE 1

Protecting a Moving Target: Addressing Web Application Concept Drift

The 12th International Symposium on Recent Advances in Intrusion Detection 2009 Federico Maggi, William Robertson, Christopher Krügel, Giovanni Vigna

Politecnico di Milano, Univeristy of California Santa Barbara

September 23, 2009

slide-2
SLIDE 2

Adapting to changes of the protected web application.

slide-3
SLIDE 3

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

slide-4
SLIDE 4

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32

slide-5
SLIDE 5

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val>

slide-6
SLIDE 6

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val> /login/<par1>/<par1-val>/<par2>/<par2-val>

slide-7
SLIDE 7

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val> /login/<par1>/<par1-val>/<par2>/<par2-val> ...

slide-8
SLIDE 8

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val> /login/<par1>/<par1-val>/<par2>/<par2-val> ... /<component1>/<par1>/<par1-val>/<par2>/<par2-val>

slide-9
SLIDE 9

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val> /login/<par1>/<par1-val>/<par2>/<par2-val> ... /<component1>/<par1>/<par1-val>/<par2>/<par2-val> /<component2>/<par1>/<par1-val>

slide-10
SLIDE 10

Web Application Anomaly Detection

Learning benign HTTP interactions (i.e., requests and responses)

/article/id/32 /comment/<par1>/<par1-val> /login/<par1>/<par1-val>/<par2>/<par2-val> ... /<component1>/<par1>/<par1-val>/<par2>/<par2-val> /<component2>/<par1>/<par1-val>

Clients Webserver

Millions of good HTTP messages

slide-11
SLIDE 11

Modeling benign HTTP interactions

slide-12
SLIDE 12

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

Models of good messages

M1 Mn M2 M3

slide-13
SLIDE 13

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

Mn M1 M3 M2

Example of models — parameter string length — numeric range — probabilistic grammar of strings — string character distribution

slide-14
SLIDE 14

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

Models of good sessions

M1 Mn M2 M3

C1 C3 C2

M1

C7 C1 C3

M2

C2 C10 C7

Mn

slide-15
SLIDE 15

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

M1 Mn M3 M2

C1 C2 C3

M1

C7 C1 C3

M2

C2 C5 C10 C3 C7

Mn

C1

slide-16
SLIDE 16

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

M1 Mn M2 M3

C1 C2 C3

M1

C7 C1 C3

M2

C2 C5 C10 C3 C7

Mn

C1

slide-17
SLIDE 17

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

Detection of bad messages

M1 Mn M2 M3

slide-18
SLIDE 18

Modeling benign HTTP interactions

Client Webserver

/<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val> /<component1>/<par1>/<par1-val>

Client Webserver Detection of bad sessions

C1 C2 C3

M1

C7 C1 C3

M2

C2 C5 C10 C3 C7

Mn

C1

slide-19
SLIDE 19

What if the modeled features change?

Note that this is the common problem of anomaly detection, per sé

slide-20
SLIDE 20

What if the modeled features change?

Note that this is the common problem of anomaly detection, per sé

In practice, what if the protected website suddenly changes?

slide-21
SLIDE 21

What if the modeled features change?

Note that this is the common problem of anomaly detection, per sé

In practice, what if the protected website suddenly changes?

◮ site changes means changes in the good behavior,

slide-22
SLIDE 22

What if the modeled features change?

Note that this is the common problem of anomaly detection, per sé

In practice, what if the protected website suddenly changes?

◮ site changes means changes in the good behavior, ◮ changes in the good behavior means obsolete training,

slide-23
SLIDE 23

What if the modeled features change?

Note that this is the common problem of anomaly detection, per sé

In practice, what if the protected website suddenly changes?

◮ site changes means changes in the good behavior, ◮ changes in the good behavior means obsolete training, ◮ obsolete training leads to FP.

slide-24
SLIDE 24

What type of changes are we concerned about?

Those that affect normality models.

slide-25
SLIDE 25

What type of changes are we concerned about?

Those that affect normality models.

◮ Request: e.g., new parameters, new domains for parameters,

L10N, I18N.

◮ Example (I18N): 3/12/2009 3:00 PM GMT-08, 3 May 2009

3:00, now.

◮ Affect: string length, char distribution, string grammar.

slide-26
SLIDE 26

What type of changes are we concerned about?

Those that affect normality models.

◮ Response: e.g., new DOM nodes, rearrangement of DOM

nodes.

◮ Example (AJAX): several nodes are enriched with client-side

code.

◮ Affect: any tree-based DOM normality models.

slide-27
SLIDE 27

What type of changes are we concerned about?

Those that affect normality models.

◮ Session: e.g., reordering of paths in a typical session,

add/rem. of authentication.

◮ Example (auth):

/site → /auth → /blog /site → /auth → /files /site → /files|/blog|/auth.

◮ Affect: sequence-based session models.

slide-28
SLIDE 28

Is this really an issue?

Todays’ websites change pretty often.

slide-29
SLIDE 29

Is this really an issue?

Todays’ websites change pretty often.

Between Jan 29 and Apr 13, 2009, we crawled:

◮ 2,264 websites drawn from Alexa’s Top 500 and googling, ◮ 3,303,816 pages instances total, ◮ 1,390 snapshots for each website.

slide-30
SLIDE 30

What type of, and how many, changes have we found?

slide-31
SLIDE 31

What type of, and how many, changes have we found?

◮ YouTube (dramatic change)

◮ richer interaction to let user rearrange widgets, ◮ this meant lots of new parameters, ◮ lots of req/res/ses changes.

slide-32
SLIDE 32

What type of, and how many, changes have we found?

◮ Yahoo! Mail

◮ new parameter for enhaced and localized search, ◮ new valid values for parameters, ◮ not many response changes,

slide-33
SLIDE 33

What type of, and how many, changes have we found?

◮ MySpace

◮ unfortunately, we found this didn’t change too much.

slide-34
SLIDE 34

What type of, and how many, changes have we found?

◮ All:

◮ 40% have new resource paths, ◮ 30% have new parameters.

slide-35
SLIDE 35

What type of, and how many, changes have we found?

We also set up a third, white box analysis (omitted in this talk) of source code, to confirm that web applications are subject to substantial changes between releases.

slide-36
SLIDE 36

Effects on a web application anomaly detector?

We performed some tests using webanomaly

slide-37
SLIDE 37

Effects on a web application anomaly detector?

We performed some tests using webanomaly

◮ Real-world training Q′ and testing datasets Q, Q ∩ Q′ = ∅:

◮ 823 unique web applications, ◮ 36,392 unique resource paths, ◮ 16,671 unique parameters, ◮ 58,734,624 HTTP messages; ◮ 1000 real-world attacks.

slide-38
SLIDE 38

Effects on a web application anomaly detector?

We performed some tests using webanomaly

◮ Real-world training Q′ and testing datasets Q, Q ∩ Q′ = ∅:

◮ 823 unique web applications, ◮ 36,392 unique resource paths, ◮ 16,671 unique parameters, ◮ 58,734,624 HTTP messages; ◮ 1000 real-world attacks.

◮ We drifted Q, obtaining a known Qdrift

◮ 6,749 new session flows, ◮ 6,750 new parameters, ◮ 5,785 modified parameters.

In this way, the set of changes in web application behavior was explicitly known.

slide-39
SLIDE 39

Details on how we built Qdrift

slide-40
SLIDE 40

Details on how we built Qdrift

◮ New session flows

/login /index /index /login /article /article

slide-41
SLIDE 41

Details on how we built Qdrift

◮ new parameters

/nav?id=21&mode=text /nav?pk=21&attr=text /all?filter=2009 /all?filter=2009&pag=true /get?id=21 /retrieve?id=21

slide-42
SLIDE 42

Details on how we built Qdrift

◮ modified parameters

?date=1944-10-14 ?date=yesterday&fmt=smart

slide-43
SLIDE 43

Effects on detection

0.5 0.6 0.7 0.8 0.9 1 0.05 0.1 0.15 0.2 True positive rate False positive rate Detection accuracy (Q) Detection accuracy (Qdrift)

slide-44
SLIDE 44

HTTP responses contain good clues about changes!

slide-45
SLIDE 45

HTTP responses contain good clues about changes!

◮ links → potential new resources and parameters,

<a href="/account/retrieve?id=22&type=ext" /> <a href="/account/history?aid=446825759916" />

slide-46
SLIDE 46

HTTP responses contain good clues about changes!

◮ forms → potential new resources,

<form name="newform" target="/account/newhandler"> <!--fields--> </form>

slide-47
SLIDE 47

HTTP responses contain good clues about changes!

◮ fields → potential new parameters and also new values.

<input type="text" name="new_parameter" /> <select name="subject"> <option>General</option> <option>User interface</option> <option>Functionality</option> <option>New value for ’subject’</option> </select>

slide-48
SLIDE 48

Parsing HTTP responses to update models

slide-49
SLIDE 49

Parsing HTTP responses to update models

Client Anomaly detector Web app.

slide-50
SLIDE 50

Parsing HTTP responses to update models

Client Anomaly detector Web app. qi qi

for each request qi

slide-51
SLIDE 51

Parsing HTTP responses to update models

Client Anomaly detector Web app. qi Parsing qi respi respi

for each request qi

intercept the corresponding response respi

slide-52
SLIDE 52

Parsing HTTP responses to update models

Client Anomaly detector Web app. qi Parsing Li, Fi qi respi respi

for each request qi

intercept the corresponding response respi extract parmeters and values from links, forms, fields

slide-53
SLIDE 53

Parsing HTTP responses to update models

Client Anomaly detector Web app. qi Parsing Li, Fi qi respi respi qi+1 qi+1

for each request qi

intercept the corresponding response respi extract parmeters and values from links, forms, fields

at next request qi+1

slide-54
SLIDE 54

Parsing HTTP responses to update models

Client Anomaly detector Web app. qi Parsing Li, Fi Change or attack? qi respi respi qi+1 qi+1

for each request qi

intercept the corresponding response respi extract parmeters and values from links, forms, fields

at next request qi+1

compare parameter and values to spot legit changes

slide-55
SLIDE 55

Example

qi = GET /page?id=14

slide-56
SLIDE 56

Example

qi = GET /page?id=14 respi =

<a href="/comments/retrieve?id=22&type=ext" /> <a href="/archive/yearly?y=2008" /> <form name="newform" target="/account/ newhandler"> <input type="text" name="new_parameter" /> <select name="subject"> <option>General</option> <option>User interface</option> <option>Functionality</option> <option>New value for ’subject’</option> </select> </form>

slide-57
SLIDE 57

Example

qi = GET /page?id=14 respi =

<a href="/comments/retrieve?id=22&type=ext" /> <a href="/archive/yearly?y=2008" /> <form name="newform" target="/account/ newhandler"> <input type="text" name="new_parameter" /> <select name="subject"> <option>General</option> <option>User interface</option> <option>Functionality</option> <option>New value for ’subject’</option> </select> </form>

qi+1 = GET /account/newhandler?new_parameter=1 would rise a false positive.

slide-58
SLIDE 58

How do we eliminate false positives?

◮ new parameters: we create a new model and we train it on

values, if any.

slide-59
SLIDE 59

How do we eliminate false positives?

◮ new session flows: we just reorder the session sequence.

slide-60
SLIDE 60

How do we eliminate false positives?

◮ new values: we can guess the type (e.g., string, token). If not

available, we trust the requests that follows.

slide-61
SLIDE 61

Does it work?

Results on Qdrift

slide-62
SLIDE 62

Does it work?

Results on Qdrift

Change type Anomalies False Positives Reduction

slide-63
SLIDE 63

Does it work?

Results on Qdrift

Change type Anomalies False Positives Reduction New session flows 6,749 100.0%

slide-64
SLIDE 64

Does it work?

Results on Qdrift

Change type Anomalies False Positives Reduction New session flows 6,749 100.0% New parameters 6,750 100.0%

slide-65
SLIDE 65

Does it work?

Results on Qdrift

Change type Anomalies False Positives Reduction New session flows 6,749 100.0% New parameters 6,750 100.0% Modified parameters 5,785 4,821 16.6%

slide-66
SLIDE 66

Does it work?

Results on Qdrift

Change type Anomalies False Positives Reduction New session flows 6,749 100.0% New parameters 6,750 100.0% Modified parameters 5,785 4,821 16.6% Total 19,284 4,821 75.0%

slide-67
SLIDE 67

Does it work?

Results on Qdrift

0.5 0.6 0.7 0.8 0.9 1 0.05 0.1 0.15 0.2 True positive rate False positive rate Detection accuracy (Q) Detection accuracy (Qdrift)

slide-68
SLIDE 68

Does it work?

Results on Qdrift

0.5 0.6 0.7 0.8 0.9 1 0.05 0.1 0.15 0.2 True positive rate False positive rate Detection accuracy (Q) Detection accuracy (Qdrift)

slide-69
SLIDE 69

Assumptions, limitations and risks

slide-70
SLIDE 70

Assumptions, limitations and risks

◮ Assumptions

◮ can detect those changes that can be “guessed” from the

responses

slide-71
SLIDE 71

Assumptions, limitations and risks

◮ Limitations

◮ modifications of existing parameters are only partially

detectable,

◮ JavaScript and rich client-side code is not analyzed, yet, but

we believe they contain lots of insights!

slide-72
SLIDE 72

Assumptions, limitations and risks

◮ Risks

◮ it trusts the application as an oracle, ◮ however, if somebody has already compromised it, we have

another problem :)

◮ right after a change occurs, the very first response is critical, ◮ if somebody manages to tamper with that, models are

poisoned

slide-73
SLIDE 73

Conclusions

slide-74
SLIDE 74

Conclusions

◮ very simple and effective at reducing FP due to changes;

slide-75
SLIDE 75

Conclusions

◮ very simple and effective at reducing FP due to changes; ◮ balance between:

◮ exposure to model poisoning, ◮ cost of false positives, ◮ cost/feasibility of manual retraining;

slide-76
SLIDE 76

Conclusions

◮ future extensions:

slide-77
SLIDE 77

Conclusions

◮ future extensions:

◮ risk mitigation: update a model only when a change in the

corresponding response is observed at least k times;

slide-78
SLIDE 78

Conclusions

◮ future extensions:

◮ risk mitigation: update a model only when a change in the

corresponding response is observed at least k times;

◮ client-side code inspection: todays’ JavaScript libraries perform

several task related to paramters and dynamic DOM construction!

slide-79
SLIDE 79

Questions?