Countermeasures 0x610~0x650 2014. 12. 4 Seokmyung Hong.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Smashing the Stack for Fun and Profit
Hacking: The Art of Exploitation
Chapter 3 (Part 1) Network Security
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
Buffer Overflow. Process Memory Organization.
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Maziéres, Dan Boneh
Guide To UNIX Using Linux Third Edition
Internet Relay Chat Chandrea Dungy Derek Garrett #29.
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
By, Anish Shanmugasundaram Yashwanth Sainath Jammi.
ITIS 2110 Class # No home network devices devices devices devices devices devices devices 9.
Shuo Chen, Jun Xu, Emre C. Sezer, Prachi Gauriar, and Ravishankar K. Iyer Brett Hodges April 8, 2010.
Port Scanning 0x470~0x480 Presenter SangDuk Seo 1.
CIS 450 – Network Security Chapter 16 – Covering the Tracks.
Computer Security and Penetration Testing
More Network Security Threats Worm = a stand-alone program that can replicate itself and spread Worms can also contain manipulation routines to perform.
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
Recitation 9: Section L (1:30pm - 2:20pm) Monday, October 22, 2012 Processes, Signals and Shell Lab Siddharth Dhulipalla.
Game Scripting by: Nicholas Haines. What is Scripting? Interpreted Language Interpreted Language –As the game runs.
CS 4010 Hacking Samba Server Vulnerabilities. Recon Telnet headers claim the following: –Red Hat Linux release 9 (Shrike) –Kernel smp on an i686.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Application Security: Electronic Commerce and Chapter 9 Copyright 2003 Prentice-Hall.
INTRUDERS BY VISHAKHA RAUT TE COMP OUTLINE INTRODUCTION TYPES OF INTRUDERS INTRUDER BEHAVIOR PATTERNS INTRUSION TECHNIQUES QUESTIONS ON INTRUDERS.
Automatic Diagnosis and Response to Memory Corruption Vulnerabilities Presenter: Jianyong Dai Jun Xu, Peng Ning, Chongkyung Kil, Yan Zhai, Chris Bookhot.
1 CSE 451 Section 2: Interrupts, Syscalls, Virtual Machines, and Project 1.
AS Computing Data Transmission and Networks. Transmission error Detecting errors in data transmission is very important for data integrity. There are.
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
Distributed System Concepts and Architectures Services
Operating Systems Process Creation
Viruses a piece of self-replicating code attached to some other code – cf biological virus both propagates itself & carries a payload – carries code to.
DoS/DDoS attack and defense
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
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.
Group 9. Exploiting Software The exploitation of software is one of the main ways that a users computer can be broken into. It involves exploiting the.
Databases Kevin Wright Ben Bruckner Group 40. Outline Background Vulnerabilities Log File Cleaning This Lab.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
I/O Software CS 537 – Introduction to Operating Systems.
Introduction to InfoSec – Recitation 3 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (infosec15 at modprobe.net)
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
1.3 System Call. System Call System calls provide the interface between a running program and the operating system. System call is a method by which a.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
Buffer Overflows ...or How I Learned to Never Trust the User
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Protecting Memory What is there to protect in memory?
Static and dynamic analysis of binaries
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Avani R.Vasant V.V.P. Engineering College
Operating System Structure
CSC 495/583 Topics of Software Security Stack Overflows (2)
CH5 TCP Client - Server Example:
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
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
Week 2: Buffer Overflow Part 2.
Crisis and Aftermath Morris worm.
Understanding and Preventing Buffer Overflow Attacks in Unix
Preventing Privilege Escalation
System and Cyber Security
Dirty COW Race Condition Attack
Return-to-libc Attacks
Race Condition Vulnerability
Presentation transcript:

Countermeasures 0x610~0x Seokmyung Hong

Countermeasures There are some ways to strengthen security One of them likes as follow New Vulnerability discovered New type of worm appear that target the vulnerability Patch the vulnerability

Countermeasures Countermeasures can be separated into two groups Detect the attack Protect vulnerability

Detect the attack The sooner an intrusion is detected, the sooner it can be dealt with and the more likely it can be contained If administrator detect the intrusion, he can handle the situation like kill the connection or process So the exploits that administrator already knows are not so dangerous

How we can detect the attack look for attack patterns in log files, network packets, or even program memory After detecting, hacker can be kicked out from system So, for the attacker, invisibility is important To stay hidden, there are some ways like remove the evidence or mimic valid ones

System Deamon Most remote targets will be a server program These programs are usually system daemons sshd, syslogd, etc A daemon is a program that runs in the background and detaches from the controlling terminal in a certain way

Crash Course in signals Signals provide a method of interprocess communication in Unix When a process receives a signal, its flow of execution is interrupted by the operating system to call a signal handler Custom signal handlers can be registered using the signal() function

signal_example.c We can see how signal used

signal_example.c Also some specific signals can be sent to process using kill command

Tinyweb Daemon Tinyweb Daemon has some differences with Tinyweb program writes its output to a log file with timestamps listens for the terminate (SIGTERM) signal so it can shut down cleanly when it’s killed

tinywebd.c

now tiny webserver is running as daemon

tinywebd Exploit Tool We cannot debug daemon in previous method

tinywebd Exploit Tool We have to follow child processes, not parent.

a

buffer start: 0xbffff5b0 RET: 0xbffff7cc offset = 540bytes

using port-binding shell code, attacker get root privilege

xtool_tinywebd.sh make tool that using same exploit method

Log Files One of the two most obvious signs of intrusion is the log file Even though the attacker’s exploits were successful, the log file keeps a painfully obvious record that something is up

tinywebd Log File Of course in this case, after the attacker gains a root shell, he can just edit the log file since it’s on the same system send to printer for hard copy, or another secure server to prevent delete the logs

Blend In with the Crowd Log files has many valid entires, but exploit log is very stick out If attacker cannot delete this log, then mimic the valid log for hide in crowd recv_line() function in tinywebd.c has vulnerability for this Using \r\b as the delimiter(other standard string functions use a null byte for this)

xtool_tinywebd_stealth.sh because of \r\n, tinywebd logs this action like the log made by valid action not log after \r\n

Overlooking the Obvious Even if log files seem like normal, if service do not operate normally, administrator knows that there are something problem So skilled hacker can not only crack open a program to exploit it, he also put the program back together again and keep it running

One Step at a Time Since it can take hours just to track down where the error occurred, it’s usually better to break a complex exploit down into smaller parts The first step should be figuring out how to put the tinyweb daemon back together after exploiting it Since the tinyweb daemon redirects standard out to /dev/null, writing to standard out isn’t a reliable marker for shellcode One simple way to prove the shellcode ran is to create a file

create the file using shellcode For testing if shellcode works or not, using shellcode includes codes for create file

Putting Things Back Together Again We need to repair any damages caused by the overwrite or shellcode, and then jump execution back into the connection accepting loop in main() To repair damages, We need to assess how much damage is done by the exploit using assembly instruction int3, which is literally a debugging breakpoint

In main() of tinyweb EBP is 0x68 bytes larger than ESP So we can restore the value for EBP by adding 0x68 to ESP at the end of shellcode

mark_restore.s This shellcode will restore the tinyweb daemon’s execution Tinyweb daemon doesn’t know that something happened

Shellcode and tinywebd both successfully worked

Child Laborers Use this technique to silently spawn a root shell We want our shellcode to fork and the child process to serve up the root shell, while the parent process restores tinywebd’s execution

loopback_shell_restore.s several instructions are added to the start of loopback_shell.s First, the fork syscall is made, and the return value is put in the EAX register The next few instructions test to see if EAX is zero If EAX is zero, we jump to child_process to spawn the shell Otherwise, we’re in the parent process, so the shellcode restores execution into tinywebd

loopback_shell_restore.s

Now we can get root privilege and run normally tinywebd