SlideShare a Scribd company logo
CLOTHO : Saving Programs from
Malformed Strings and Incorrect
String-handling
Aritra Dhar
M.Tech CSE (MT12004)
Information Security
Thesis Committee
Dr. Rahul Purandare (Advisor)
Dr. Mohan Dhawan (External Reviewer)
Dr. Sambuddho Chakravarty (Internal Reviewer)
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
2
Problem Definition
 Runtime Exceptions go unnoticed at the time of
development.
 Restart/shutdown can be very expensive or
unacceptable.
 Example :
 Air-traffic control
 Autopilot
 UAV drones,
 life-support system
 smart power grid
 telephone network
 software controlled gas pipeline and many more.
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
3
Problem Definition
 Vulnerability in the code may be targeted by the
attacker.
 Crash is bad for business.
 3rd party library: no control over the sources.
 Classify candidates for patching : financial
transactions should not be repaired/patched.
 Major problem – availability
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
4
Why String?
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
5
 Heavily used
 Incorrect string handling and Malformed String
 Large number of major, critical and blocker priority
bugs.
Challenges
 No access of source code.
 Logic is unknown.
 Patching based on the program behavior and
information available in the byte code.
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
6
Most Frequently used Java String APIs
 String APIs
 Java SE String library
(java.lang.{String, StringBuffer, StringBuilder})
 Apache Commons
(org.apache.commons.lang.{StringUtils,StringEscapeUtils})
(http://commons.apache.org/)
 Google Guava (com.google.common.base.Strings)
(https://code.google.com/p/guava-libraries/)
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
7
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
8
Related Works
 Cabin et al.(’11), Perkins et al.(’09) Dynamic approaches :
memory, data, and incorrect programming constructs such
as infinite loops
 Demsky et al. (’03, ’05, ’06) Data structure repairing by
isolating damaged data or memory portion
 Eom et al.(’12) Delay execution till program self-stabilizes
 Pezze et al.(’11) Find alternative execution paths
 Long et al. (’14) Suppressing signals and attach lightweight
monitors for divide by zero and null dereferencing errors
 Cerny et al.(’14), Wei et al. (’10) develop patch and check
correctness by computationally intensive techniques such
as model-checking
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
9
Outline
 Problem definition
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
10
Contribution
 Novel hybrid technique for patch generation which
ensures patch quality to be as per developers’ fix.
 Fully automated end-to-end tool : CLOTHO; soon to
be open sourced.
 Repairing solutions over 64+ String based API calls.
 Promising results for popular 30 java 3rd party
library bug.
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
11
Outline
 Problem Definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
12
Example
Apache FileUtils bug
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
13
No boundary check
Example : Automated Patch
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
14
Example : Developers’ Patch
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
15
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
16
Design Goals
 High patch fidelity
 Precise
 Preserve intended program behavior
 Non-invasive instrumentation
 No side effect
 Patch triggers only when crash is imminent
 Low system overhead
 None when no exception
 Minimal incase patch triggers
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
17
CLOTHO : Overall Design
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
18
• Taint Analysis
• Call graph analysis
Java byte code
Design : Taint Analysis Module
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
19
Call Graph Analysis
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
20
foo()
bar()
g()
h()
 Look in the call sight of all the
ancestors.
 Level order traversal.
Design : Patching Module
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
21
Constraint analysis
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
22
//user input
//may fail
//may fail
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
23
Constraint Collection
𝑆𝑡 ∗ 𝑂𝑃
𝑆𝑡. 𝑠𝑡𝑎𝑟𝑡𝑠𝑊𝑖𝑡ℎ 𝑠 ⇒ ( 𝑆𝑡) 𝑠𝑡𝑎𝑟𝑡𝑠𝑊𝑖𝑡ℎ (𝑠 )
𝑆𝑡. 𝑙𝑒𝑛𝑔𝑡ℎ < 5 ⇒ ((𝑆𝑡) 𝑙𝑒𝑛𝑔𝑡ℎ < (5))
Static Constraint Evaluation
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
24
Min Length Max Length Prefix set Contains set
abcd
Dynamic Constraint Collection &
Evaluation
 Also need to collect the static constraints and re
evaluate.
 Evaluate only if necessary
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
25
What if nothing works?
 Parameter tweaking
 Evaluate safe indices from string properties
 Recall the 1st example
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
26
What if nothing works?
 Fallback to parameter tweaking
 Look for the string properties
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
27
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
28
Implementation
 End-to-end repairing tool chain written in java
~15KLOC.
 Soot (version 2.5.0) for byte code analysis and
instrumentation.
 Soot infoFlow (May 2014 snapshot) for static taint
analysis.
 Java Decompiler (version 0.7.0.7) for visual inspection
of the instrumentation.
 Optimizations
 Minimize constraint analysis
 Minimize patch instrumentation
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
29
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
30
Evaluation metrics
 Program Quality Index (PQI)
 Taint analysis precession
 Flow Consistency Index (FCI)
𝐹𝐶𝐼 = 𝑛 (𝐹𝐶𝐼 ≥ 0)
 Cascaded exceptions
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
31
CLOTHO Evaluation
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
32
CLOTHO Performance
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
33
CLOTHO Performance
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
34
CLOTHO Overheads
 Execution overhead
 None in case of no exception
 Average overhead of ~2.32 𝜇𝑠 per call for 50𝐾 runs.
 Maximum overhead of ~3.96 𝜇𝑠 per call for Apache
Hive
 Call graph
 Apache wicket ~70𝐾
 Analysis time ~52.4 𝑠 and 210 𝑀𝐵 memory
 Constraint analysis
 At most ~5𝑠 for collection and evaluation
 Instrumentation
 At most 4𝑠
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
35
Outline
 Problem definition & Motivation
 Related Works
 Contribution
 Example
 Repairing Strategy : CLOTHO design
 Implementation
 Evaluation
 Conclusion
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
36
Conclusion & Future work
 In most of the cases CLOTHO generates efficient
patches.
 Adding more support for other Java APIs.
 Adding more intelligence to patching mechanism
for more effective patch.
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
37
Thank you
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
38
Constraint Collection
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
39
Constraint Evaluation
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
40
Fallback : Parameter Tweaking
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
41
Patching Strategy
4/1/2015
CLOTHO : Saving Programs from Malformed
Strings and Incorrect
42

More Related Content

What's hot (19)

PDF
Solutions manual for c++ programming from problem analysis to program design ...
Warren0989
 
PDF
Staroletov Design by Contract, verification of Cyber-physical systems
Sergey Staroletov
 
PPTX
Sta unit 2(abimanyu)
Abhimanyu Mishra
 
PPT
Open-DO Update
AdaCore
 
PDF
150412 38 beamer methods of binary analysis
Raghu Palakodety
 
PPTX
Unit 3 Control Flow Testing
ravikhimani
 
PDF
Tyuukan
ssuser36ebb8
 
PDF
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
ijseajournal
 
PPTX
Static analysis works for mission-critical systems, why not yours?
Rogue Wave Software
 
PPT
9781439035665 ppt ch02
Terry Yoast
 
PPTX
Unit1
Abhimanyu Mishra
 
PPTX
Csc1100 lecture01 ch01 pt2-paradigm
IIUM
 
PDF
Static Code Analysis and Cppcheck
Zachary Blair
 
PPTX
Unit 2 unit testing
ravikhimani1984
 
PPTX
Sta unit 3(abimanyu)
Abhimanyu Mishra
 
PPT
Chap02
Terry Yoast
 
PPTX
Sta unit 4(abimanyu)
Abhimanyu Mishra
 
PPT
Testing
Mohammed
 
PDF
[IJCT-V3I2P28] Authors: KulbirKaur, AnureetKaur
IJET - International Journal of Engineering and Techniques
 
Solutions manual for c++ programming from problem analysis to program design ...
Warren0989
 
Staroletov Design by Contract, verification of Cyber-physical systems
Sergey Staroletov
 
Sta unit 2(abimanyu)
Abhimanyu Mishra
 
Open-DO Update
AdaCore
 
150412 38 beamer methods of binary analysis
Raghu Palakodety
 
Unit 3 Control Flow Testing
ravikhimani
 
Tyuukan
ssuser36ebb8
 
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
ijseajournal
 
Static analysis works for mission-critical systems, why not yours?
Rogue Wave Software
 
9781439035665 ppt ch02
Terry Yoast
 
Csc1100 lecture01 ch01 pt2-paradigm
IIUM
 
Static Code Analysis and Cppcheck
Zachary Blair
 
Unit 2 unit testing
ravikhimani1984
 
Sta unit 3(abimanyu)
Abhimanyu Mishra
 
Chap02
Terry Yoast
 
Sta unit 4(abimanyu)
Abhimanyu Mishra
 
Testing
Mohammed
 
[IJCT-V3I2P28] Authors: KulbirKaur, AnureetKaur
IJET - International Journal of Engineering and Techniques
 

Viewers also liked (10)

PDF
Designing and Evaluating Techniques to
 Mitigate Misinformation Spread on 
Mi...
IIIT Hyderabad
 
PDF
Broker Bots: Analyzing automated activity during High Impact Events on Twitter
Cybersecurity Education and Research Centre
 
PPTX
Exploration of gaps in Bitly's spam detection and relevant countermeasures
Cybersecurity Education and Research Centre
 
PDF
Web Application Security 101
Cybersecurity Education and Research Centre
 
PDF
Novel Instruction Set Architecture Based Side Channels in popular SSL/TLS Imp...
Cybersecurity Education and Research Centre
 
PDF
Automated Methods for Identity Resolution across Online Social Networks
Cybersecurity Education and Research Centre
 
PDF
Video Inpainting detection using inconsistencies in optical Flow
Cybersecurity Education and Research Centre
 
PPT
Easiest Way to Write a Thesis Statement
CustomWriting
 
PDF
Twitter and Polls: What Do 140 Characters Say About India General Elections 2014
Cybersecurity Education and Research Centre
 
PDF
Araling panlipunan grades 1 10 01.17.2014 edited march 25 2014
Dep ED
 
Designing and Evaluating Techniques to
 Mitigate Misinformation Spread on 
Mi...
IIIT Hyderabad
 
Broker Bots: Analyzing automated activity during High Impact Events on Twitter
Cybersecurity Education and Research Centre
 
Exploration of gaps in Bitly's spam detection and relevant countermeasures
Cybersecurity Education and Research Centre
 
Web Application Security 101
Cybersecurity Education and Research Centre
 
Novel Instruction Set Architecture Based Side Channels in popular SSL/TLS Imp...
Cybersecurity Education and Research Centre
 
Automated Methods for Identity Resolution across Online Social Networks
Cybersecurity Education and Research Centre
 
Video Inpainting detection using inconsistencies in optical Flow
Cybersecurity Education and Research Centre
 
Easiest Way to Write a Thesis Statement
CustomWriting
 
Twitter and Polls: What Do 140 Characters Say About India General Elections 2014
Cybersecurity Education and Research Centre
 
Araling panlipunan grades 1 10 01.17.2014 edited march 25 2014
Dep ED
 
Ad

Similar to Clotho : Saving Programs from Malformed Strings and Incorrect (20)

PPTX
Model Drift Monitoring using Tensorflow Model Analysis
Vivek Raja P S
 
PPT
Intro To AOP
elliando dias
 
PDF
Wait for it: identifying “On-Hold” self-admitted technical debt
RungrojMaipradit1
 
PPTX
A year of SonarQube and TFS/VSTS
Matteo Emili
 
PDF
Software Testing: Test Design and the Project Life Cycle
Derek Callaway
 
PDF
Python for Machine Learning
Student
 
PPT
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
RahithAhsan1
 
PPTX
Chapter one Project Quality Management system
burkarobeengineering
 
PDF
FiQuant Market Microstructure Simulator: Strategy Definition Language
Anton Kolotaev
 
PDF
Fehlmann and Kranich - Measuring tests using cosmic
International Software Benchmarking Standards Group (ISBSG)
 
PDF
Error isolation and management in agile
ijccsa
 
PDF
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
neirew J
 
PPT
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Amine Barrak
 
PPTX
SE2023 0401 Software Coding and Testing.pptx
Bharat Chawda
 
PDF
Towards Developing a Repository of Logical Errors Observed in Parallel Code t...
Ritu Arora
 
PDF
DHSSTTSL11192.HSI Process (1)
John Chin
 
PDF
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
mwpeexdvjgtqujwhog
 
PPTX
Defect Tracking Software Project Presentation
Shiv Prakash
 
PPT
Introduction to llvm
Tao He
 
Model Drift Monitoring using Tensorflow Model Analysis
Vivek Raja P S
 
Intro To AOP
elliando dias
 
Wait for it: identifying “On-Hold” self-admitted technical debt
RungrojMaipradit1
 
A year of SonarQube and TFS/VSTS
Matteo Emili
 
Software Testing: Test Design and the Project Life Cycle
Derek Callaway
 
Python for Machine Learning
Student
 
CS2006Ch02A.ppt dfxgbfdcgbhfcdhbfdcbfdcgfdg
RahithAhsan1
 
Chapter one Project Quality Management system
burkarobeengineering
 
FiQuant Market Microstructure Simulator: Strategy Definition Language
Anton Kolotaev
 
Fehlmann and Kranich - Measuring tests using cosmic
International Software Benchmarking Standards Group (ISBSG)
 
Error isolation and management in agile
ijccsa
 
Error Isolation and Management in Agile Multi-Tenant Cloud Based Applications
neirew J
 
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Amine Barrak
 
SE2023 0401 Software Coding and Testing.pptx
Bharat Chawda
 
Towards Developing a Repository of Logical Errors Observed in Parallel Code t...
Ritu Arora
 
DHSSTTSL11192.HSI Process (1)
John Chin
 
st-notes-13-26-software-testing-is-the-act-of-examining-the-artifacts-and-the...
mwpeexdvjgtqujwhog
 
Defect Tracking Software Project Presentation
Shiv Prakash
 
Introduction to llvm
Tao He
 
Ad

More from Cybersecurity Education and Research Centre (9)

PPTX
TASVEER : Tomography of India’s Internet Infrastructure
Cybersecurity Education and Research Centre
 
PDF
Data-Driven Assessment of Cyber Risk: Challenges in Assessing and Migrating C...
Cybersecurity Education and Research Centre
 
PDF
A Strategy for Addressing Cyber Security Challenges
Cybersecurity Education and Research Centre
 
PDF
Identification and Analysis of Malicious Content on Facebook: A Survey
Cybersecurity Education and Research Centre
 
PDF
National Critical Information Infrastructure Protection Centre (NCIIPC): Role...
Cybersecurity Education and Research Centre
 
PDF
Analyzing Social and Stylometric Features to Identify Spear phishing Emails
Cybersecurity Education and Research Centre
 
PDF
Emerging Phishing Trends and Effectiveness of the Anti-Phishing Landing Page
Cybersecurity Education and Research Centre
 
PDF
Securing the Digital Enterprise
Cybersecurity Education and Research Centre
 
PDF
The future of interaction & its security challenges
Cybersecurity Education and Research Centre
 
TASVEER : Tomography of India’s Internet Infrastructure
Cybersecurity Education and Research Centre
 
Data-Driven Assessment of Cyber Risk: Challenges in Assessing and Migrating C...
Cybersecurity Education and Research Centre
 
A Strategy for Addressing Cyber Security Challenges
Cybersecurity Education and Research Centre
 
Identification and Analysis of Malicious Content on Facebook: A Survey
Cybersecurity Education and Research Centre
 
National Critical Information Infrastructure Protection Centre (NCIIPC): Role...
Cybersecurity Education and Research Centre
 
Analyzing Social and Stylometric Features to Identify Spear phishing Emails
Cybersecurity Education and Research Centre
 
Emerging Phishing Trends and Effectiveness of the Anti-Phishing Landing Page
Cybersecurity Education and Research Centre
 
Securing the Digital Enterprise
Cybersecurity Education and Research Centre
 
The future of interaction & its security challenges
Cybersecurity Education and Research Centre
 

Recently uploaded (20)

PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Practical Applications of AI in Local Government
OnBoard
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 

Clotho : Saving Programs from Malformed Strings and Incorrect

  • 1. CLOTHO : Saving Programs from Malformed Strings and Incorrect String-handling Aritra Dhar M.Tech CSE (MT12004) Information Security Thesis Committee Dr. Rahul Purandare (Advisor) Dr. Mohan Dhawan (External Reviewer) Dr. Sambuddho Chakravarty (Internal Reviewer)
  • 2. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 2
  • 3. Problem Definition  Runtime Exceptions go unnoticed at the time of development.  Restart/shutdown can be very expensive or unacceptable.  Example :  Air-traffic control  Autopilot  UAV drones,  life-support system  smart power grid  telephone network  software controlled gas pipeline and many more. 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 3
  • 4. Problem Definition  Vulnerability in the code may be targeted by the attacker.  Crash is bad for business.  3rd party library: no control over the sources.  Classify candidates for patching : financial transactions should not be repaired/patched.  Major problem – availability 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 4
  • 5. Why String? 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 5  Heavily used  Incorrect string handling and Malformed String  Large number of major, critical and blocker priority bugs.
  • 6. Challenges  No access of source code.  Logic is unknown.  Patching based on the program behavior and information available in the byte code. 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 6
  • 7. Most Frequently used Java String APIs  String APIs  Java SE String library (java.lang.{String, StringBuffer, StringBuilder})  Apache Commons (org.apache.commons.lang.{StringUtils,StringEscapeUtils}) (http://commons.apache.org/)  Google Guava (com.google.common.base.Strings) (https://code.google.com/p/guava-libraries/) 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 7
  • 8. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 8
  • 9. Related Works  Cabin et al.(’11), Perkins et al.(’09) Dynamic approaches : memory, data, and incorrect programming constructs such as infinite loops  Demsky et al. (’03, ’05, ’06) Data structure repairing by isolating damaged data or memory portion  Eom et al.(’12) Delay execution till program self-stabilizes  Pezze et al.(’11) Find alternative execution paths  Long et al. (’14) Suppressing signals and attach lightweight monitors for divide by zero and null dereferencing errors  Cerny et al.(’14), Wei et al. (’10) develop patch and check correctness by computationally intensive techniques such as model-checking 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 9
  • 10. Outline  Problem definition  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 10
  • 11. Contribution  Novel hybrid technique for patch generation which ensures patch quality to be as per developers’ fix.  Fully automated end-to-end tool : CLOTHO; soon to be open sourced.  Repairing solutions over 64+ String based API calls.  Promising results for popular 30 java 3rd party library bug. 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 11
  • 12. Outline  Problem Definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 12
  • 13. Example Apache FileUtils bug 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 13 No boundary check
  • 14. Example : Automated Patch 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 14
  • 15. Example : Developers’ Patch 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 15
  • 16. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 16
  • 17. Design Goals  High patch fidelity  Precise  Preserve intended program behavior  Non-invasive instrumentation  No side effect  Patch triggers only when crash is imminent  Low system overhead  None when no exception  Minimal incase patch triggers 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 17
  • 18. CLOTHO : Overall Design 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 18 • Taint Analysis • Call graph analysis Java byte code
  • 19. Design : Taint Analysis Module 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 19
  • 20. Call Graph Analysis 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 20 foo() bar() g() h()  Look in the call sight of all the ancestors.  Level order traversal.
  • 21. Design : Patching Module 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 21
  • 22. Constraint analysis 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 22 //user input //may fail //may fail
  • 23. 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 23 Constraint Collection 𝑆𝑡 ∗ 𝑂𝑃 𝑆𝑡. 𝑠𝑡𝑎𝑟𝑡𝑠𝑊𝑖𝑡ℎ 𝑠 ⇒ ( 𝑆𝑡) 𝑠𝑡𝑎𝑟𝑡𝑠𝑊𝑖𝑡ℎ (𝑠 ) 𝑆𝑡. 𝑙𝑒𝑛𝑔𝑡ℎ < 5 ⇒ ((𝑆𝑡) 𝑙𝑒𝑛𝑔𝑡ℎ < (5))
  • 24. Static Constraint Evaluation 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 24 Min Length Max Length Prefix set Contains set abcd
  • 25. Dynamic Constraint Collection & Evaluation  Also need to collect the static constraints and re evaluate.  Evaluate only if necessary 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 25
  • 26. What if nothing works?  Parameter tweaking  Evaluate safe indices from string properties  Recall the 1st example 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 26
  • 27. What if nothing works?  Fallback to parameter tweaking  Look for the string properties 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 27
  • 28. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 28
  • 29. Implementation  End-to-end repairing tool chain written in java ~15KLOC.  Soot (version 2.5.0) for byte code analysis and instrumentation.  Soot infoFlow (May 2014 snapshot) for static taint analysis.  Java Decompiler (version 0.7.0.7) for visual inspection of the instrumentation.  Optimizations  Minimize constraint analysis  Minimize patch instrumentation 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 29
  • 30. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 30
  • 31. Evaluation metrics  Program Quality Index (PQI)  Taint analysis precession  Flow Consistency Index (FCI) 𝐹𝐶𝐼 = 𝑛 (𝐹𝐶𝐼 ≥ 0)  Cascaded exceptions 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 31
  • 32. CLOTHO Evaluation 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 32
  • 33. CLOTHO Performance 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 33
  • 34. CLOTHO Performance 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 34
  • 35. CLOTHO Overheads  Execution overhead  None in case of no exception  Average overhead of ~2.32 𝜇𝑠 per call for 50𝐾 runs.  Maximum overhead of ~3.96 𝜇𝑠 per call for Apache Hive  Call graph  Apache wicket ~70𝐾  Analysis time ~52.4 𝑠 and 210 𝑀𝐵 memory  Constraint analysis  At most ~5𝑠 for collection and evaluation  Instrumentation  At most 4𝑠 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 35
  • 36. Outline  Problem definition & Motivation  Related Works  Contribution  Example  Repairing Strategy : CLOTHO design  Implementation  Evaluation  Conclusion 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 36
  • 37. Conclusion & Future work  In most of the cases CLOTHO generates efficient patches.  Adding more support for other Java APIs.  Adding more intelligence to patching mechanism for more effective patch. 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 37
  • 38. Thank you 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 38
  • 39. Constraint Collection 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 39
  • 40. Constraint Evaluation 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 40
  • 41. Fallback : Parameter Tweaking 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 41
  • 42. Patching Strategy 4/1/2015 CLOTHO : Saving Programs from Malformed Strings and Incorrect 42