System and Cyber Security

Slides:



Advertisements
Similar presentations
Buffer Overflows Nick Feamster CS 6262 Spring 2009 (credit to Vitaly S. from UT for slides)
Advertisements

Smashing the Stack for Fun and Profit
David Brumley Carnegie Mellon University Credit: Some slides from Ed Schwartz.
Introduction to Information Security ROP – Recitation 5 nirkrako at post.tau.ac.il itamarg at post.tau.ac.il.
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Review: Software Security David Brumley Carnegie Mellon University.
Intro to Exploitation Stack Overflows James McFadyen UTD Computer Security Group 10/20/2011.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Memory Image of Running Programs Executable file on disk, running program in memory, activation record, C-style and Pascal-style parameter passing.
1 Function Calls Professor Jennifer Rexford COS 217 Reading: Chapter 4 of “Programming From the Ground Up” (available online from the course Web site)
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
The OWASP Top 10 and Buffer Overflow Attacks
Introduction to InfoSec – Recitation 2 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2011.
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
Buffer Overflows : An In-depth Analysis. Introduction Buffer overflows were understood as early as 1972 The legendary Morris Worm made use of a Buffer.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Mitigation of Buffer Overflow Attacks
CSCD 303 Essential Computer Security Spring 2013 Lecture 17 Buffer Overflow Attacks.
Buffer Overflow CS461/ECE422 Spring Reading Material Based on Chapter 11 of the text.
Exploitation Of Windows Buffer Overflows. What is a Buffer Overflow A buffer overflow is when memory is copied to a location that is outside of its allocated.
Smashing the Stack Overview The Stack Region Buffer Overflow
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
Overflows & Exploits. In the beginning 11/02/1988 Robert Morris, Jr., a graduate student in Computer Science at Cornell, wrote an experimental, self-replicating,
Lecture 8: Buffer Overflow CS 436/636/736 Spring 2013 Nitesh Saxena *Adopted from a previous lecture by Aleph One (Smashing the Stack for Fun and Profit)
CNIT 127: Exploit Development Ch 1: Before you begin.
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
Introduction to Information Security ROP – Recitation 5.
JMU GenCyber Boot Camp Summer, Introduction to Penetration Testing Elevating privileges – Getting code run in a privileged context Exploiting misconfigurations.
Information Security - 2. A Stack Frame. Pushed to stack on function CALL The return address is copied to the CPU Instruction Pointer when the function.
ROP Exploit. ROP Return Oriented Programming (ROP): is a hacking exploit technique where you exploit buffer overflow to inject a chain of gadgets. Each.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
Chapter 10 Buffer Overflow 1. A very common attack mechanism o First used by the Morris Worm in 1988 Still of major concern o Legacy of buggy code in.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Heap Overflow Attacks.
Content Coverity Static Analysis Use cases of Coverity Examples
Exploiting & Defense Day 1 Recap
Introduction to Information Security
Let’s look at an example
Buffer Overflow By Collin Donaldson.
Mitigation against Buffer Overflow Attacks
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Protecting Memory What is there to protect in memory?
Introduction to Information Security
The Hardware/Software Interface CSE351 Winter 2013
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Introduction to Information Security
Exploiting & Defense Day 2 Recap
Introduction to Compilers Tim Teitelbaum
CMSC 414 Computer and Network Security Lecture 21
Summary by - Bo Zhang and Shuang Guo [Date: 03/31/2014]
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Assembly Language Programming II: C Compiler Calling Sequences
Software Security Lesson Introduction
Lecture 9: Buffer Overflow*
Smashing the Stack for Fun and Profit
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2015.
System Calls David Ferry CSCI 3500 – Operating Systems
Introduction to Static Analyzer
CS5123 Software Validation and Quality Assurance
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2016.
Understanding and Preventing Buffer Overflow Attacks in Unix
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2013.
Week 3: Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

System and Cyber Security Kamlesh K. Biloniya Divya Chauhan Chaman Agrawal Kushagra Rajput Mentors: Siddarth Krishnamoorthy Soumye Singhal Semester Project'17 27 january – 15 april

System and Cyber Security Abstract: this  project was about learning, exploring and exploiting various security vulnerability in a program.  Project was mostly based on system vulnerabilities under “old-style” Linux system. Contents: Basic linux command ssh login Assembly Language Buffer overflow attack Format string attack

Linux Basics Read, Write & Execute Permissions Permissions are the basic "rights" to act on a file or directory. The basic rights are read, write and execute. Read - a readable permission allows the contents of the file to be viewed Write - a write permission on a file allows you to modify the contents of that file. Execute - for a file, the executable permission allows to run the file and execute a program.  We can view permissions for file for directory by ls –l command. 

chmod grep cat file ls cd find

SSH (the Secure Shell)  Using SSH requires a client on the local computer and a server on the remote one.  It establishes an encrypted connection to a remote computer, executes a command there and redirects its input and output across the connection.

Assembly Language  Assembly language is a low-level programming language. Assembly language is converted into executable machine code by an assembler. Computer basically consist of two things: CPU and memory. And there is some internal memory (registers) only accessible to CPU.

Some Assembly Instructions mov eax, ebx — copy the value in ebx into eax push eax — push eax on the stack lea eax, [var] — the value in var is placed in EAX. jmp begin — Jump to the instruction labeled begin

Program Memory Stack Unused memory heap .bss .data .text Used for storing function argument and local variable Dynamic memory-malloc() Uninitialized data Initialized data Program code

General Stack Layout 0xffffffff int AddMe(int a, int b) { int c; c=a+b; return c; } main(){ AddMe(10,20) print(); return 0; High memory 12(%EBP) 8(%EBP) 4(%EBP) %EPB -4(%EBP) 0xffffffff  Arg2 Arg1 RET EBP-old Local var

Buffer overflow GetInput{ Char buffer[8]; gets(buffer); puts(buffer); Simple Vulnerable Function:  GetInput{                   Char buffer[8];                   gets(buffer);                   puts(buffer); } Buffer: A  Temporary space in memory used for hold data. Buffer overflow: Happens when data written to the buffer is larger then size of buffer and due to insufficient bound checking it overflows and overwrites adjacent memory location. Gets() does not check if input size is greater than size  of buffer

        Format String Attack: The Format String exploit occurs when the submitted data of an input string is evaluated as a command by the application. Using format String vulnerability we can read the stack , execute  code .

Format string vulnerable function:- gets(),scanf(), printf() ,Strcpy() , strcat() ….etc(they don't check size of input or output) Format parameters :- %n  Write an integer to the location in the process memory   %x    Read data from stack %s  Read character string from process memory 

      Continue..........          With summer project

Pwntools CTF framework Written in python Makes exploitation easy >>> from pwn import *   # it imports a lot of functionality into global namespace >>> p=process('/bin/sh') # starts process  >>>p.sendline('input')     # sends input >>>p.recvline(timeout=5) # receives output 

Canaries: Canaries are stack guard Used to check stack buffer overflow But there are many techniques to bypass canaries

Shellcode injection and ROP Exploiting to execute your own code with Root permission               Three step Procedure : Crafting shellcode Injecting shellcode Modify Execution flow –Run the shellcode 

buffer overflow: how It Works ??? Code:: #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h>  int main(int argc, char* argv[]){     if(argc == 2){         if(filter(argv[1]))             exit(1);         else{             setenv("PATH", "/nonsense", 1);             printf("%s", argv[1]);             system(argv[1]);         }     }     else{         printf("Usage: ./cmd COMMAND\n");         exit(1);     return 0; int filter(char *s){      int r = 0;                  r+=(int)strstr(s, "/");                     r+=(int)strstr(s, "sh");                    r+=(int)strstr(s, "*");                         r+=(int)strstr(s, "flag");                          r+=(int)strstr(s, "who");                            r+=(int)strstr(s, "PATH");                      r+=(int)strstr(s, "=");                     r+=(int)strstr(s, "{");                      r+=(int)strstr(s, "}");    return r;  } 

Web Based Attack CSRF (Cross-site request forgery) XSS  (Cross site scripting ) Attack  1. reflected xss attack 2. stored xss attack 3. DOM-based xss attack

 Reflected xss attack

         Continue ….... Course/project under Sandeep K. Shukla - Computer System Security / CS628A 1 june – 31 july