Professional Documents
Culture Documents
Users
Utility Programs (shell, editor, …)
User Mode
Libraries (open, close, read, …)
Kernel Mode OS (Management of Memory, Processes, …)
Hardware (CPU, RAM, Disks, …)
[Tane]
Seite 23 Prof. Dr. A. Lehmann | IT Security
Memory Layout
Memory partitions for OS and programs
Problem: Job A
• Protect programs against each other
• Protect OS against programs Job B
Solution:
Job C
• Separate address space
− Kernel space, lower addresses
− User space, higher addresses
Operating
• Operating modes System
Memory
− User mode
Partitions
− System mode
[Tane]
Seite 24 Prof. Dr. A. Lehmann | IT Security
System and User Mode
System Mode
• Hardware access only through privileged commands
User Mode
• Applications are running in user mode
[Tane]
Seite 25 Prof. Dr. A. Lehmann | IT Security
Device Driver
Device drivers are components of the OS
• Will be executed in privileged mode
[Tane]
Seite 26 Prof. Dr. A. Lehmann | IT Security
Virtual Address Space
• Each process owns a virtual address space (e.g. 4 GB)
[Baun]
[Tane]
Seite 27 Prof. Dr. A. Lehmann | IT Security
Memory Allocation
4 GByte
local variables,
Stack register,
parameters
(stack grows)
[Tane]
Seite 28 Prof. Dr. A. Lehmann | IT Security
Dynamic and Static Linking
Static Libraries Application Application
• Statically linked into an executable A B
Static Static
Library Library
Shared
• Physically loaded into memory once Library
int main()
{
char src[] = “itsecpasswd”;
char dest[7];
strcpy(dest, src);
return 0;
}
Buffer 8 bytes Overflow
i t s e c p a s s w d
[Ecke]
Seite 30 Prof. Dr. A. Lehmann | IT Security
Exploits and Defense
To exploit any type of buffer overflow the attacker needs
• To identify vulnerability in some program
• To understand how buffer will be stored in processes memory
Compile-time defence
• Choose high-level language (e.g. JAVA)
• Encourage safe coding standards
• Use safe libraries
• Additional code to detect corruption (Stackguard)
Runtime
• Executable address space protection
• Address space randomization
[Stal1]
Seite 31 Prof. Dr. A. Lehmann | IT Security
Access Control and Rights
• Users are identified by system (authentication, password, username)
• Index node (inode) contains links to addresses and blocks of file content
$ ls -l /home
drwxr-xr-x 3 root root 4096 Sep 9 2016 home
Position File
1 Type of file: d (directory) – (ordinary file) l (symbolic link)
2-4 Owner permissions: r (read) w (write) x (execute)
5-7 Permissions for other users in same group
8-10 Permissions for all users
OS OS OS
[Kapp]
Seite 37 Prof. Dr. A. Lehmann | IT Security