Vulnerability Assessment and Secure Coding Practices for Middleware

Similar documents
First Principles Vulnerability Assessment. Motivation

Part of a Security Strategy

First Principles Vulnerability Assessment

10 common programming mistakes that make you vulnerable to attack

Argus Vulnerability Assessment *1

Data Security and Privacy. Unix Discretionary Access Control

autodie - Replace functions with ones that succeed or die with lexical scope # Recommended: implies 'use autodie qw(:default)'

CYSE 411/AIT 681 Secure Software Engineering. Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun

4. Risk-Based Security Testing. Reading. CYSE 411/AIT 681 Secure Software Engineering. Seven Touchpoints. Application of Touchpoints

VULNERABILITY ASSESSMENT ENHANCEMENT FOR MIDDLEWARE FOR COMPUTING AND INFORMATICS. Jairo Serrano, Elisa Heymann, Eduardo Cesar.

EUROPEAN MIDDLEWARE INITIATIVE

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

CSE 565 Computer Security Fall 2018

C and C++ Secure Coding 4-day course. Syllabus

Department of Computer Science and Technology, UTU 2014

Secure Architecture Principles

Overview. Over the next four weeks, we will look at these topics: Building Blocks. Advanced Authentication Issues.

Creating a Shell or Command Interperter Program CSCI411 Lab

Process. Program Vs. process. During execution, the process may be in one of the following states

C1: Define Security Requirements

Secure Architecture Principles

Inter-Process Communication

Explicit Information Flow in the HiStar OS. Nickolai Zeldovich, Silas Boyd-Wickizer, Eddie Kohler, David Mazières

UNIX input and output

Engineering Your Software For Attack

Protect Your Application with Secure Coding Practices. Barrie Dempster & Jason Foy JAM306 February 6, 2013

Secure Architecture Principles

Sistemas Operativos /2016 Support Document N o 1. Files, Pipes, FIFOs, I/O Redirection, and Unix Sockets

Symlink attacks. Do not assume that symlinks are trustworthy: Example 1

St. MARTIN S ENGINEERING COLLEGE Dhulapally,Secunderabad DEPARTMENT OF INFORMATION TECHNOLOGY Academic year

Software Security and Exploitation

Threat Modeling. Bart De Win Secure Application Development Course, Credits to

6.858 Lecture 4 OKWS. Today's lecture: How to build a secure web server on Unix. The design of our lab web server, zookws, is inspired by OKWS.

Secure Software Programming and Vulnerability Analysis

Computer Security. 04r. Pre-exam 1 Concept Review. Paul Krzyzanowski. Rutgers University. Spring 2018

"Charting the Course to Your Success!" Securing.Net Web Applications Lifecycle Course Summary

Secure Architecture Principles

glideinwms architecture by Igor Sfiligoi, Jeff Dost (UCSD)

How to Configure Authentication and Access Control (AAA)

Cassandra Database Security

Web Application & Web Server Vulnerabilities Assessment Pankaj Sharma

Hunting Security Bugs

RBS NetGain Enterprise Manager Multiple Vulnerabilities of 11

Tutorial 4: Condor. John Watt, National e-science Centre

Solutions Business Manager Web Application Security Assessment

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

GUI based and very easy to use, no security expertise required. Reporting in both HTML and RTF formats - Click here to view the sample report.

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

Copyright

Specialized Security Services, Inc. REDUCE RISK WITH CONFIDENCE. s3security.com

Secure Architecture Principles

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

IT Service Delivery and Support Week Three. IT Auditing and Cyber Security Fall 2016 Instructor: Liang Yao

UNIT I Linux Utilities

Babu Madhav Institute of Information Technology, UTU

Interprocess Communication. Originally multiple approaches Today more standard some differences between distributions still exist

CS 361 Computer Systems Fall 2017 Homework Assignment 4 - Inter-Process Communications & I/O

OWASP 5/07/09. The OWASP Foundation OWASP Static Analysis (SA) Track Session 1: Intro to Static Analysis

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

Outline. Operating System Security CS 239 Computer Security February 23, Introduction. Server Machines Vs. General Purpose Machines

CS 385 Operating Systems Fall 2011 Homework Assignment 5 Process Synchronization and Communications

(In columns, of course.)

WHITEPAPER. Vulnerability Analysis of Certificate Validation Systems

OWASP TOP Release. Andy Willingham June 12, 2018 OWASP Cincinnati

We ve seen: Protection: ACLs, Capabilities, and More. Access control. Principle of Least Privilege. ? Resource. What makes it hard?

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

Confinement (Running Untrusted Programs)

I m paranoid, but am I paranoid enough? Steven M. Bellovin February 20,

CSC209 Review. Yeah! We made it!

Firewalls Network Security: Firewalls and Virtual Private Networks CS 239 Computer Software March 3, 2003

CSE 565 Computer Security Fall 2018

CSE506: Operating Systems CSE 506: Operating Systems

Unix Processes. What is a Process?

CNIT 129S: Securing Web Applications. Ch 10: Attacking Back-End Components

Operating system security models

Chair for Network Architectures and Services Department of Informatics TU München Prof. Carle. Network Security. Chapter 8

glideinwms Training Glidein Internals How they work and why by Igor Sfiligoi, Jeff Dost (UCSD) glideinwms Training Glidein internals 1

Students should have an understanding and a working knowledge in the following topics, or attend these courses as a pre-requisite:

Virtual File System. Don Porter CSE 306

Locking down a Hitachi ID Suite server

CptS 360 (System Programming) Unit 6: Files and Directories

WEB APPLICATION SCANNERS. Evaluating Past the Base Case

Virtual File System. Don Porter CSE 506

Question No: 1 After running a packet analyzer on the network, a security analyst has noticed the following output:

Application Security Introduction. Tara Gu IBM Product Security Incident Response Team

STING: Finding Name Resolution Vulnerabilities in Programs

PERL - FUNCTIONS REFERENCES

Kishin Fatnani. Founder & Director K-Secure. Workshop : Application Security: Latest Trends by Cert-In, 30 th Jan, 2009

CSE543 - Introduction to Computer and Network Security. Module: Operating System Security

SAP Security. BIZEC APP/11 Version 2.0 BIZEC TEC/11 Version 2.0

Least-Privilege Isolation: The OKWS Web Server

CSCI 4500 Operating Systems. In This Module

CS631 - Advanced Programming in the UNIX Environment Interprocess Communication I

Question No: 2 Which identifier is used to describe the application or process that submitted a log message?

CIS 5373 Systems Security

Process Management! Goals of this Lecture!

Verification & Validation of Open Source

Transcription:

Vulnerability Assessment and Secure Coding Practices for Middleware Barton P. Miller James A. Kupsch Computer Sciences Department University of Wisconsin bart@cs.wisc.edu Elisa Heymann Computer Architecture and Operating Systems Department Universitat Autònoma de Barcelona elisa@cs.wisc.edu EPIC Systems March 11, 2010 This research funded in part by Department of Homeland Security grant FA8750-10-2-0030 (funded through AFRL). Past funding has been provided by NATO grant CLG 983049, National Science Foundation grant OCI-0844219, the National Science Foundation under contract with San Diego Supercomputing Center, and National Science 1 Foundation grants CNS-0627501 and CNS-0716460. Roadmap Part 1: Vulnerability Assessment Process Part 2: Secure Coding Practices 2

Key Issues for Security Need independent assessment Software engineers have long known that testing groups must be independent of development groups Need an assessment process that is NOT based solely on known vulnerabilities Such approaches will not find new types and variations of attacks 3 Key Issues for Security Automated Analysis Tools have Serious Limitations While they help find some local errors, they MISS significant vulnerabilities (false negatives) Produce voluminous reports (false positives) Programmers must be security-aware Designing for security and the use of secure practices and standards does not guarantee security 4

Addressing these Issues We must evaluate the security of our code The vulnerabilities are there and we want to find them first Assessment isn t cheap Automated tools create an illusion of security You can t take shortcuts Even if the development team is good at testing, they can t do an effective assessment of their own code 5 Addressing these Issues First Principles Vulnerability Assessment (FPVA) A strategy that focuses on critical resources A strategy that is not based solely on known vulnerabilities We need to integrate assessment and remediation into the software development process We have to be prepared to respond to the vulnerabilities we find 6

Goal of FPVA Understand a software system to focus search for security problems Find vulnerabilities Make the software more secure A vulnerability is a defect or weakness in system security procedures, design, implementation, or internal controls that can be exercised and result in a security breach or violation of security policy. - Gary McGraw, Software Security i.e., a bad thing 7 First Principles Vulnerability Assessment Step 1: Architectural Analysis Step 2: Resource Identification Step 3: Trust & Privilege Analysis Step 4: Component Evaluation Step 5: Dissemination of Results 8

Studied Systems Condor, University of Wisconsin Batch queuing workload management system SRB, SDSC Storage Resource Broker - data grid MyProxy, NCSA Credential Management System glexec, Nikhef Identity mapping service CrossBroker, Universitat Autònoma de Barcelona Resource Manager for Parallel and Interactive Applications Gratia Condor Probe, NCSA Feeds Condor Usage into Gratia Accounting System Condor Quill, University 9 of Wisconsin Studied Systems Wireshark (in progress) Network Protocol Analyzer Condor Privilege Separation, University of Wisconsin (in progress) Restricted Identity Switching Module VOMS Admin, Instituto Nazionale di Fisica Nucleare (in progress) Virtual Organization Management Service 10

First Principles Vulnerability Assessment Understanding the System Step 1: Architectural Analysis Functionality and structure of the system major components (modules, threads, processes), communication channels Interactions among components and with users 11 Step 1: Architectural Analysis User Supplied Data All attacks ultimately arise from attacker (user) communicated data Attack surface: Interfaces available to the attacker If not, your system is malware: mere installation causes a security violation Important to know where the system gets user supplied data What data can users inject into the system 12

Step 1: Architectural Analysis Create a detailed big picture view of the system Document and diagram What processes/hosts exist and their function How users interact with them How executables interact with each other 13 Step 1: Architectural Analysis External Services Used How are external programs used External services Database (DBMS, LDAP, DNS, ) Web server Application server Other External executables launched Signs in the code: popen system exec* 14

Step 1: Architectural Analysis Process Communication Channels What exists between Servers Client and server Client/Server and external programs DBMS DNS LDAP Kerberos File services: NFS AFS ftp http Helper applications Shows interaction between components 15 Step 1: Architectural Analysis Communication Methods OS provides a large variety of communication methods Command line Environment Files Sockets Creating processes Signals IPC Directories Pipes Symbolic links FIFO's or named pipes System V IPC Memory mapped files 16

Step 1: Architectural Analysis Command Line Null-terminated array of strings passed to a starting process from its parent Convention is that argv[0] is the path to executable file Signs in code C/C++: argc argv Perl: $0 @ARGV Sh: $0 $1 $2 $# $@ $* Csh: $0 argv 17 Step 1: Architectural Analysis Sockets Creates a communication path processes on same host between hosts using protocols such as TCP/IP Can be stream or message based Signs in code C/C++: socket bind connect listen accept socketpair send sendto sendmsg recv recvfrom recvmsg getpeername getsockname setsockopt getsockopt shutdown 18

Step 1: Architectural Analysis IPC Inter- and Intra-host communication methods Some can pass file descriptors between processes Signs in code: Pipes: pipe, mkfifo SysV Message Q: msgget msgctl msgsnd msgrcv SysV Semaphore: semget shmctl semop SysV Shared Mem: shmget shmctl shmat shmdt Memory mapped files: mmap 19 Condor Step 1: Architectural Analysis Condor execute host master OS privileges 1. fork 1. fork condor & root user negotiator collector 5. Negotiator cycle Condor submit host master Condor execute host master 1. fork schedd 5. Negotiator cycle 6. Report match 6. Report match 2. machine ClassAd startd 1. fork 4. job ClassAd 8. fork shadow 7. claim host 8. fork starter Stork server host master 3. submit job ClassAd submit 9. establish channel job 10. start job 1. fork stork_server 20

SRB OS privileges srb postgresql user Step 1: Architectural Analysis SRB server host SRB master SRB client host MCAT host SRB client process 1. connect MCAT PostgreSQL 2. fork SRB agent 3. authenticate 3&4. use MCAT 4. do work 21 First Principles Vulnerability Assessment Understanding the System Step 2: Resource Identification Key resources accessed by each component Operations allowed on those resources 22

Step 2: Resource Analysis A resource is an object that is useful to a user of the system and is controlled by the system Data files DBMS memory Physical entities Disk space CPU cycles Network bandwidth Attached devices (sensors, controllers) 23 Step 2: Resource Identification Documenting Resources What resources exist in the system What executables/hosts control the resource What operations are allowed What does an attacker gaining access to the resource imply 24

Step 2: Resource Identification Files Represented by a path File descriptors represent files in program From opening or creating a file Inherited from parent process Contents can be data, configuration, executable code, library code, scripts Signs in code: C/C++: open creat fopen dlopen *stream 25 Step 2: Resource Identification Standard File Descriptors Convention is creating process opens file descriptors 0, 1 and 2 for use by the created process to be used as standard in, out, and err Functions and libraries often implicitly use these and expect them to be opened Signs in code C/C++: stdin stdout stderr STDIN_FILENO STDOUT_FILENO STDERR_FILENO getchar gets scanf printf vprintf vscanf cin cout cerr 26

Step 2: Resource Identification Directories List of named file system objects Operations: Get list of entries Create entry Rename entry Delete entry Entries have metadata like type, size, and owner Signs in code: C/C++: opendir readdir closedir creat open (with O_CREAT) fdopen mkdir mkfifo mknod symlink link unlink remove rename rmdir 27 Step 2: Resource Identification Symbolic Links File system object that contains a path (referent) When evaluating a path the operating system follows the referent in the link Operations: Create symbolic link (can t modify) Read referent Signs in code: C/C++: implicitly in any function taking a path, symlink readlink 28

Step 2: Resource Identification (a) Common Resources on All Condor Hosts (b) Unique Condor Checkpoint Server Resources generic Condor daemon OS privileges condor ckpt_server root user Condor Binaries & Libraries etc Condor Config spool Operational Data & Run-time Config Files log Operational Log Files Send and Receive Checkpoints (with Standard Universe Jobs) ckpt Checkpoint Directory (c) Unique Condor Execute Resources (d) Unique Condor Submit Resources User Job starter shadow System Call Forwarding and Remove I/O (with Standard Universe Jobs) execute Job Execution Directories 29 user User s Files SRB Step 2: Resource Identification OS privileges srb postgresql user SRB server host SRB master & agents SRB client host MCAT host SRB client process MCAT PostgreSQL SRB config files client home dir & config files SRB data Store 1 SRB data Store 2 30 SRB tape storage db config files db data store

First Principles Vulnerability Assessment Understanding the System Step 3: Trust & Privilege Analysis How components are protected and who can access them Privilege level at which each component runs Trust delegation 31 Step 3: Trust & Privilege Analysis Process Attributes What user/group is the process started as Is the process setuid/setgid Any unusual process attributes uid/gid switching 32

Step 3: Trust & Privilege Analysis Privilege is the authorization for a user to perform an operation on a resource What privileges exist in the system Do they map appropriately to operations on resources Are they fine grained enough How are they enforced 33 Step 3: Trust & Privilege Analysis Authentication Is it performed correctly and securely If an attacker can authenticate as another user they gain their privileges 34

Step 3: Trust & Privilege Analysis External Privilege Systems System used: OS, DBMS, Accounts and privileges used Purpose of each account Does the program use external privileges to enforce its privilege model Are minimal privileges used Use of root or admin accounts require special attention 35 Step 3: Trust & Privilege Analysis Trust An executable trusts another when It relies on a behavior in the other Doesn't or can't verify the behavior Implicit trust The operating system Process with root privilege on the same host they can do anything Processes with same uid on the same host they can do anything to each other All the code in your executable including libraries 36

Step 3: Trust & Privilege Analysis Bad trust Not validating data from another trust domain for proper form (form, length, range) Bad assumptions User supplied data is in proper form Data passed through client is unchanged 37 Step 3: Trust & Privilege Analysis More Bad Trust Bad assumptions (cont.) Client validated data Client can be rewritten or replaced Good to validate on the client, but server validation is required Not validating data from trusted processes Allows an attack to spread Not defense in depth 38

First Principles Vulnerability Assessment Search for Vulnerabilities Step 4: Component Evaluation Examine critical components in depth Guide search using: Diagrams from steps 1-3 Knowledge of vulnerabilities Helped by Automated scanning tools (!) 39 Step 4: Component Evaluation Categories of Vulnerabilities Design Flaws Problems inherent in the design Occur about equally! Hard to automate discovery Implementation Bugs Improper use of the programming language, or of a library API Localized in the code Operational vulnerabilities Configuration or environment Social Engineering Valid users tricked into attacking 40

Step 4: Component Evaluation Many Types of Vulnerabilities Buffer overflows Injection attacks Command injection (in a shell) Format string attacks (in printf/scanf) SQL injection Cross-site scripting or XSS (in HTML) Directory traversal Integer vulnerabilities Race conditions Not properly dropping privilege Insecure permissions Denial of service Information leaks Lack of integrity checks Lack of authentication Lack of authorization 41 Step 4: Component Evaluation Focusing the Search It's impossible to completely analyze a system for vulnerabilities From critical resources and try to think of ways an attack can be realized From vulnerabilities can occur in the code to resources Look for similar problems to prior security problems 42

Step 4: Component Evaluation Process Configuration How is an executable configured Configuration file Hard coded Other What can be configured How does it affect the application Often reveals functional and architectural information 43 Step 4: Component Evaluation Communication Methods OS provides a large variety of communication methods Command line Environment Files Sockets Creating processes Signals IPC Directories Pipes Symbolic links FIFO's or named pipes System V IPC Memory mapped files 44

First Principles Vulnerability Assessment Taking Actions Step 5: Dissemination of Results Report vulnerabilities Interaction with developers Disclosure of vulnerabilities 45 Step 5: Dissemination of Results Vulnerability Report One report per vulnerability Provide enough information for developers to reproduce and suggest mitigations Written so that a few sections can be removed and the abstracted report is still useful to users without revealing too much information to easily create an attack. 46

First Principles Vulnerability Assessment Taking Actions Step 5: Dissemination of Results 47 Step 5: Dissemination of Results Vulnerability Report Items Summary Affected version(s) and platform Fixed version(s) Availability - is it known or being exploited Access required - what type of access does an attacker require: local/remote host? Authenticated? Special privileges? Effort required (low/med/high) - what type of skill and what is the probability of success 48

Step 5: Dissemination of Results Vulnerability Report Items Impact/Consequences (low/med/high) - how does it affect the system: minor information leak is low, gaining root access on the host is high Only in full report Full details - full description of vulnerability and how to exploit it Cause - root problem that allows it Proposed fix - proposal to eliminate problem Actual fix - how it was fixed 49 Step 5: Dissemination of Results Vulnerability Disclosure Process Disclose vulnerability reports to developers Allow developers to mitigate problems in a release Now here s the really hard part: Publish abstract disclosures in cooperation with developers. When? Publish full disclosures in cooperation with developers. When? 50

Summary of Results First Principles Vulnerability Assessment Technique has been extremely successful found critical problems helped groups redesign software changed their development practices and release cycle management First Principles Vulnerability Assessment (FPVA) white paper: http://www.cs.wisc.edu/mist/papers/va.pdf 51 Our Work -- Summary Assess:! We continue to assess new software systems Train:! We present tutorials and white papers, and continue to develop new educational materials Research: Our results provide the foundation for new research to make FPVA less labor-intensive and improve quality of automated code analysis 52