Kenfe-Mickaël Laventure Laurent Malvert Macquarie University 2008-11-12 LEMONA Linux Enhanced Monitoring Architecture Linux zest for security.

Slides:



Advertisements
Similar presentations
Symbol Table.
Advertisements

Threads, SMP, and Microkernels
Christo Wilson Project 2: User Programs in Pintos
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
1 (Review of Prerequisite Material). Processes are an abstraction of the operation of computers. So, to understand operating systems, one must have a.
PSUCS322 HM 1 Languages and Compiler Design II IR Code Generation I Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU.
CSCC69: Operating Systems
Building and Running Modules Sarah Diesburg COP 5641.
Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
1 Pointers A pointer variable holds an address We may add or subtract an integer to get a different address. Adding an integer k to a pointer p with base.
Chapter 9 Subprogram Control Consider program as a tree- –Each parent calls (transfers control to) child –Parent resumes when child completes –Copy rule.
Security at the VMM Layer Theodore Winograd OWASP June 14, 2007.
1 Building with Assurance CSSE 490 Computer Security Mark Ardis, Rose-Hulman Institute May 10, 2004.
40 Advanced Operating Systems Implementing System Calls.
Overview C programming Environment C Global Variables C Local Variables Memory Map for a C Function C Activation Records Example Compilation.
CSE 451 Section 4 Project 2 Design Considerations.
Linux Operating System
PRASHANTHI NARAYAN NETTEM.
Fork and Exec Unix Model Tutorial 3. Process Management Model The Unix process management model is split into two distinct operations : 1. The creation.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
Data Structures in the Kernel Sarah Diesburg COP 5641.
Operating System Program 5 I/O System DMA Device Driver.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
CS 501: Software Engineering Fall 1999 Lecture 16 Verification and Validation.
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Today’s Topics Introducing process: the basic mechanism for concurrent programming –Process management related system calls Process creation Process termination.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Kenfe-Mickael Laventure Laurent Malvert Macquarie University LEMONA Linux Enhanced Monitoring Architecture Linux zest for security.
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
© 2004, D. J. Foreman 1 Implementing Processes and Threads.
C Functions Three major differences between C and Java functions: –Functions are stand-alone entities, not part of objects they can be defined in a file.
CPS4200 Unix Systems Programming Chapter 2. Programs, Processes and Threads A program is a prepared sequence of instructions to accomplish a defined task.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
LOGO System Call. Introduction System call is the mechanism used by an application program to request service from the OS. Users use it to communicate.
Operating Systems Process Creation
CS 261 – Data Structures C Pointers Review. C is Pass By Value Pass-by-value: a copy of the argument is passed in to a parameter void foo (int a) { a.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
COMP 3438 – Part I - Lecture 5 Character Device Drivers
Pointer Lecture 2 Course Name: High Level Programming Language Year : 2010.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Kernel Structure and Infrastructure David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Revisiting building. Preprocessing + Compiling 2 Creates an object file for each code file (.c ->.o) Each.o file contains code of the functions and structs.
Study on “Secure In-VM Monitoring Using Hardware Virtualization” Qiang.Guan Dependable Computing System Lab New Mexico Tech.
Unit 10 Code Reuse. Key Concepts Abstraction Header files Implementation files Storage classes Exit function Conditional compilation Command-line arguments.
Secure Coding Rules for C++ Copyright © 2016 Curt Hill
Linux Kernel Module Programming
Protection of System Resources
System Design.
Processes David Ferry, Chris Gill
High Coverage Detection of Input-Related Security Faults
Fork and Exec Unix Model
Chapter 2: The Linux System Part 2
IS3440 Linux Security Unit 7 Securing the Linux Kernel
Kernel Structure and Infrastructure
CS 6560 Operating System Design
Operation System Program 1
CS 6560 Operating System Design Kernel Loadable Modules
Lecture 6: Multiprogramming and Context Switching
C Miscellaneous Programs Prabhat Kumar Padhy
Foundations and Definitions
Processes David Ferry, Chris Gill, Brian Kocoloski
Dirty COW Race Condition Attack
Presentation transcript:

Kenfe-Mickaël Laventure Laurent Malvert Macquarie University LEMONA Linux Enhanced Monitoring Architecture Linux zest for security

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Outline Lemona –Project –Overview –Architecture –Workflow –Code Review Macros Structures Mixers Blades –Build –Load / Unload References

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Project Open Architecture –Open Protocols –Open Source Implementation Decentralized –Local Tracing Components –Remote Monitoring Components Prevention, Detection, Forensics, Recovery –Possible…?

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Overview Exhaustiveness –Kernel Land Tracer  100% User Land Coverage Integrity –Harder to bypass  Would require Kernel Level code –Integrity Checks Flexible –Variable Granularity Levels –Selectable Hooks

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Architecture User Application SysCallEntryExecutionReturn Memory Mapped File Open Read/Write Page Fault Close Inside Attackers Outside Attackers Target Storage Point Forensics Tools Lemona traces transmission Architecture > ^ Workflow / Hooks

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Workflow

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Code Review Lemona –Statically compiled; or –Loaded as a Linux Kernel Module Mixers –Definitions of structures and function pointers –to record system call activity Blades –Predefined functions to process system calls’ parameters Zests –Custom structures to transfer and store records

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Macros extern atomic_tlemona_activated; static lemonalogfn_lemona_log= NULL; # define lemona_block_start\ if (atomic_read(&lemona_activated) != 0)\ { # define lemona_log_in(sysnr, argnr, extnr,...)\ __lemona_log(sysnr, true, argnr, extnr, ## __VA_ARGS__) # define lemona_log_out(sysnr, argnr, extnr,...)\ __lemona_log(sysnr, false, argnr, extnr, ## __VA_ARGS__) # define lemona_block_end\ }\ else {\ _lemona_log = NULL;\ } #define __lemona_log(sysnr, in, argnr, extnr,...) {\ if (_lemona_log == NULL)\ _lemona_log = (lemonalogfn)kallsyms_lookup_name("lemona_log");\ _lemona_log(sysnr, in, argnr, extnr, ## __VA_ARGS__);\ }

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Macros lemona_block_start { lemona_log_in(__NR_open, 3, 0, filename, &flags, &mode); } lemona_block_end; preprocessing (CPP) if (atomic_read(&lemona_activated) != 0) { if (_lemona_log == NULL) _lemona_log = (lemonalogfn)kallsyms_lookup_name("lemona_log"); _lemona_log(__NR_open, true, 3, 0, filename, &flags, &mode); } else { _lemona_log = NULL; }

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Structures structlemona_zest { charmagic[4];/* magic number*/ intsize; /* size taken by this zest and args sz/value*/ intin;/* input or output ?*/ struct timespectime;/* call start/end time (getnstimeofday)*/ pid_tpid;/* actual pid*/ pid_t tgid;/* thread group id*/ uid_tuid,euid,fsuid; /* user identification numbers*/ gid_tgid,egid,fsgid; /* group identification numbers*/ intsysnr; /* syscall id*/ intargnr;/* number of args*/ int*argsz;/* ptr to an array of int giving each arg size*/ void*args;/* ptr to the first argument of the array*/ intextnr;/* extra value number*/ int*extsz;/* size of each extension*/ void*exts;/* extra values. located after the last arg*/ } __attribute__((packed));

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Structures structlemona_mixer { intsysnr;/* system call number*/ struct __lemona_mixerin;/* call entrance mixer*/ struct __lemona_mixerout;/* call exit mixer*/ } struct__lemona_mixer { intargnr;/* number of syscall parameters*/ intextnr;/* number of extra parameters*/ struct __lemona_mixer_handlerhandlers[6];/* pre-defined handlers*/ }; struct__lemona_mixer_handler { booldual;/* is this a dual blade?*/ bladefnblade;/* number of extra parameters*/ }; typedef int(*bladefn)(struct lemona_zest*zest,/* zest to fill*/ intisExt,/* is an extra?*/ intidx,/* which arg/ext?*/ intoff,/* memory offset*/ void*fruit1, /* 1st data arg*/ void*fruit2);/* 2nd data arg*/

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Mixers const struct lemona_mixerlemona_mixers[]= { /*... */ {.sysnr= __NR_open,.in= {.argnr= 3,.extnr= 0,.handlers= { {.dual= false,.blade = lemona_blade_string_null}, {.dual= false,.blade = lemona_blade_integer}, } },.out= {.argnr= 1,.extnr= 1,.handlers= { {.dual= false,.blade = lemona_blade_integer}, {.dual= false,.blade = lemona_blade_string_fd}, }, } }, /*... */ };

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Blades (blades/generics.c)Generics intlemona_blade_integer(...); intlemona_blade_integer64(...); intlemona_blade_long(...); intlemona_blade_long_long(...); intlemona_blade_output_buffer(...); (blades/strings.c)Strings intlemona_blade_string_null(...); intlemona_blade_string_fd(...); (blades/iovec.c)Input/Output Vectors intlemona_blade_iovec(...);

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Build $> cd $(PATH_TO_KERNEL_SRC) $> wget $> patch -p1 < patch $> make menuconfig $> make && makes modules_install && make install

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Lemona > Load / Unload $> cd $(PATH_TO_MODULES) $> sudo insmod./lemona.ko $> dmesg | tail -2 -==Lemona==- Initialization for kernel tree ==Lemona==- Done. $> sudo rmmod lemona $> dmesg | tail -2 -==Lemona==- Uninitializing... -==Lemona==- Done.

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert Outline Security and Forensics –Forensics –Computer Security –Computer Forensics Related Work Lemona –Project –Overview –Architecture References

Lemona – Linux Enhanced Monitoring Architecture Laventure / Malvert References [home] [blog] [wiki] [SCM] [group]