SlideShare a Scribd company logo
1 of 11
File Access Reporter
Charles Chen
Outline
• introduction
• design & implementation
• experiment result & limitation
Introduction
• Security issue: File accessibility of a program
• We all want to know what files an application would access
• We want know the fact before running it
• Simple static analysis tool
• analysis files a JAVA program might access
Main idea
• Assumption: a JAVA program would always using
”java.io.File” to operate on a file object
• analysis possible String values reach File constructors
Forward V.S. Backward analysis
• Forward:
• track all strings
• evaluate their values
• record if they reach a File constructor
• Backward:
• start at File constructors
• only record their arguments
• evaluate arguments’ values backward
Backward is less expensive!
<entry>
str = …str = …
<exit>
else then
File file = new File(str);
D
Binary Tree Representation & Lattice
• solve Variables (VAR) to Values (VAL)
• semi-lattice
TOP
MERGE
VAR VAL
S
+
L
VAR VAL
str + “literal”
Dynamic Substitution by Last Definition
parDir = new File(“dir”);
String suffix = “.txt”;
String child = “impossible”;
child = “aFile” + suffix;
new File (parDir, child);
parDir
/
child
parDir
/
+
aFile suffix
parDir
/
+
aFile .txt
dir
/
+
aFile .txt
Experiment Result – loop
Experiment result – loop2
Experiment Result – real code from github
Limitation
• Local dataflow analysis
• cannot infer possible values of a field
• cannot infer possible values return by a method invocation
• cannot estimate value in while loop when value is related to the times
of iteration
• e.g. while (c) { path += ”a” };
• Didn’t consider “File.rename()” method and “new File(URI uri)”
constructor in current implementation

More Related Content

What's hot

Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Sam Bowne
 
Open Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering ProcessOpen Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering ProcessSteve Arnold
 
02 beginning code first
02   beginning code first02   beginning code first
02 beginning code firstMaxim Shaptala
 
Tuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingTuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingPranavSB
 

What's hot (9)

Tips to improve your code review
Tips to improve your code reviewTips to improve your code review
Tips to improve your code review
 
LINQ for absolute beginners
LINQ for absolute beginnersLINQ for absolute beginners
LINQ for absolute beginners
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
 
Open Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering ProcessOpen Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering Process
 
Shellcode mastering
Shellcode masteringShellcode mastering
Shellcode mastering
 
02 beginning code first
02   beginning code first02   beginning code first
02 beginning code first
 
Tuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingTuples, Dicts and Exception Handling
Tuples, Dicts and Exception Handling
 
Can you TDD Rails?
Can you TDD Rails?Can you TDD Rails?
Can you TDD Rails?
 
Python programming l2
Python programming l2Python programming l2
Python programming l2
 

Similar to project-presentation

CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfVithalReddy3
 
File Handling Python
File Handling PythonFile Handling Python
File Handling PythonAkhil Kaushik
 
Pf cs102 programming-8 [file handling] (1)
Pf cs102 programming-8 [file handling] (1)Pf cs102 programming-8 [file handling] (1)
Pf cs102 programming-8 [file handling] (1)Abdullah khawar
 
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security AssuranceSec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security AssuranceAbdessamad TEMMAR
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in javaNilesh Dalvi
 
14 file handling
14 file handling14 file handling
14 file handlingAPU
 
Files in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for referenceFiles in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for referenceanuvayalil5525
 
Reading and Writing Files
Reading and Writing FilesReading and Writing Files
Reading and Writing Filesprimeteacher32
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization Hitesh-Java
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, SerializationPawanMM
 
Working with file(35,45,46)
Working with file(35,45,46)Working with file(35,45,46)
Working with file(35,45,46)Dishant Modi
 

Similar to project-presentation (20)

CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdf
 
File handling
File handlingFile handling
File handling
 
working with files
working with filesworking with files
working with files
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
Files and streams
Files and streamsFiles and streams
Files and streams
 
Java I/O
Java I/OJava I/O
Java I/O
 
Unit-4 PPTs.pptx
Unit-4 PPTs.pptxUnit-4 PPTs.pptx
Unit-4 PPTs.pptx
 
Pf cs102 programming-8 [file handling] (1)
Pf cs102 programming-8 [file handling] (1)Pf cs102 programming-8 [file handling] (1)
Pf cs102 programming-8 [file handling] (1)
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
 
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security AssuranceSec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance
 
Ruby1_full
Ruby1_fullRuby1_full
Ruby1_full
 
Ruby1_full
Ruby1_fullRuby1_full
Ruby1_full
 
Data file handling
Data file handlingData file handling
Data file handling
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
14 file handling
14 file handling14 file handling
14 file handling
 
Files in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for referenceFiles in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for reference
 
Reading and Writing Files
Reading and Writing FilesReading and Writing Files
Reading and Writing Files
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, Serialization
 
Working with file(35,45,46)
Working with file(35,45,46)Working with file(35,45,46)
Working with file(35,45,46)
 

project-presentation

  • 2. Outline • introduction • design & implementation • experiment result & limitation
  • 3. Introduction • Security issue: File accessibility of a program • We all want to know what files an application would access • We want know the fact before running it • Simple static analysis tool • analysis files a JAVA program might access
  • 4. Main idea • Assumption: a JAVA program would always using ”java.io.File” to operate on a file object • analysis possible String values reach File constructors
  • 5. Forward V.S. Backward analysis • Forward: • track all strings • evaluate their values • record if they reach a File constructor • Backward: • start at File constructors • only record their arguments • evaluate arguments’ values backward Backward is less expensive! <entry> str = …str = … <exit> else then File file = new File(str); D
  • 6. Binary Tree Representation & Lattice • solve Variables (VAR) to Values (VAL) • semi-lattice TOP MERGE VAR VAL S + L VAR VAL str + “literal”
  • 7. Dynamic Substitution by Last Definition parDir = new File(“dir”); String suffix = “.txt”; String child = “impossible”; child = “aFile” + suffix; new File (parDir, child); parDir / child parDir / + aFile suffix parDir / + aFile .txt dir / + aFile .txt
  • 10. Experiment Result – real code from github
  • 11. Limitation • Local dataflow analysis • cannot infer possible values of a field • cannot infer possible values return by a method invocation • cannot estimate value in while loop when value is related to the times of iteration • e.g. while (c) { path += ”a” }; • Didn’t consider “File.rename()” method and “new File(URI uri)” constructor in current implementation