UNIX Technical Audit. UNIX Architecture  Multi-user, multi-processing system  Kernel: Primary control program  Daemons: System control processes Manages.

Slides:



Advertisements
Similar presentations
The UNIX File System Harry Chen Department of CSEE University of MD Baltimore County.
Advertisements

Sonny J Zambrana University of Pennsylvania ISC-SEO November 2008.
Unit 5 – User Administration Randy Marchany VA Tech Computing Center.
Basic Unix system administration
Suneeta Chawla Web Security Presentation Topic : IP Spoofing Date : 03/24/04.
Unix Refresher This presentation is an amalgam of presentations by Mark Michael, Randy Marchany and Ed Skoudis. I have edited and added material. Dr. Stephen.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
SSH : The Secure Shell By Rachana Maheswari CS265 Spring 2003.
2000 Copyrights, Danielle S. Lahmani UNIX Tools G , Fall 2000 Danielle S. Lahmani Lecture 11.
Information Networking Security and Assurance Lab National Chung Cheng University Investigating Unix System.
Linux+ Guide to Linux Certification, Second Edition
Chapter 3 Unix Overview. Figure 3.1 Unix file system.
CS 497C – Introduction to UNIX Lecture 35: - TCP/IP Networking Tools Chin-Chih Chang
Network File System (NFS) in AIX System COSC513 Operation Systems Instructor: Prof. Anvari Yuan Ma SID:
Linux System Administration LINUX SYSTEM ADMINISTRATION.
Copyright © 2002 ProsoftTraining. All rights reserved. Operating System Security.
O.S security Ge Zhang Karlstad University. Outline Why O.S. security is important? Security schemes in Unix/Linux system Security schemes in windows system.
1 Infrastructure Hardening. 2 Objectives Why hardening infrastructure is important? Hardening Operating Systems, Network and Applications.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Mid 1960 ’ s - Multics - proposed by AT&T, Honeywell, GE & MIT; funded by DARPA Thompson & Ritchie create Unix 1978 to 84 - Bill Joy & Chuck Haley.
1 Network File Sharing. 2 Module - Network File Sharing ♦ Overview This module focuses on configuring Network File System (NFS) for servers and clients.
CIS 218 Advanced UNIX 1 User and System Information CIS 218.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Managing User Accounts. Module 2 – Creating and Managing Users ♦ Overview ► One should log into a Linux system with a valid user name and password granted.
Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set.
TELE 301 Lecture 10: Scheduled … 1 Overview Last Lecture –Post installation This Lecture –Scheduled tasks and log management Next Lecture –DNS –Readings:
Day 11 SAMBA NFS Logs Managing Users. SAMBA Implements the ability for a Linux machine to communicate with and act like a Windows file server. –Implements.
Module 4 - File Security. Security Overview File Ownership Access to Files and Dircetories Changing File and Directory Ownership Changing File and Directory.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
ITI-481: Unix Administration Meeting 3 Christopher Uriarte, Instructor Rutgers University Center for Applied Computing Technologies.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 10.4 File System Mounting A file system must be mounted before it can be accessed.
Linux Networking Security Sunil Manhapra & Ling Wang Project Report for CS691X July 15, 1998.
Users Greg Porter V1.0, 26 Jan 09. What is a user? Users “own” files and directories Permission based on “ownership” Every user has a User ID (UID) 
Managing Users  Each system has two kinds of users:  Superuser (root)  Regular user  Each user has his own username, password, and permissions that.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 13 FTP and Telnet.
Unix Security.  Security architecture  File system and user accounts  Integrity management  Auditing and intrusion detection.
Chapter 3 & 6 Root Status and users File Ownership Every file has a owner and group –These give read,write, and execute priv’s to the owner, group, and.
Linux Security. Authors:- Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of CodeSourcery LLC published by New Riders Publishing.
1 Linux Networking and Security Chapter 5. 2 Configuring File Sharing Services Configure an FTP server for anonymous or regular users Set up NFS file.
1 LINUX SECURITY. 2 Outline Introduction Introduction - UNIX file permission - UNIX file permission - SUID / SGID - SUID / SGID - File attributes - File.
1 Chapter Overview Creating Web Sites and FTP Sites Creating Virtual Directories Managing Site Security Troubleshooting IIS.
Securing the Linux Operating System Erik P. Friebolin.
The Saigon CTT Chapter 10 Managing Users. The Saigon CTT  Objectives  Define the requirements for user accounts  Explain group and group accounts 
CSCI 330 The UNIX System Unit V Permissions. all access to directories and files is controlled UNIX uses discretionary access control (DAC) model each.
SCSC 455 Computer Security Chapter 3 User Security.
Chapter 8 File System Security. File Protection Schemes Password-Based Protection Encryption-Based Protection Protection-Based on Access Permission.
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
Linux Use the Command-Line Interface to Administer the System.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Jozef Goetz, expanded by Jozef Goetz, 2008 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
Managing Users CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
SSH. 2 SSH – Secure Shell SSH is a cryptographic protocol – Implemented in software originally for remote login applications – One most popular software.
Karlstad University Operating System security Ge Zhang Karlstad University.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Chapter 11: Managing Users
Module 4 Remote Login.
Chapter 2 User Management
Overview of Unix Jagdish S. Gangolly School of Business
SECURITY IN THE LINUX OPERATING SYSTEM
Operating System Security
Linux Security.
The Attack and Defense of Computers
Rootly Powers Chapter 3.
Adding New Users.
Designing IIS Security (IIS – Internet Information Service)
Preventing Privilege Escalation
Presentation transcript:

UNIX Technical Audit

UNIX Architecture  Multi-user, multi-processing system  Kernel: Primary control program  Daemons: System control processes Manages system resources Shared by multiple users Run with Kernel authority

UNIX Architecture (Cont.)  User processes: no special privileges unless specifically defined  Root directory: /

UNIX Users and Groups  User name and password required (pay attention to ‘open’ accounts: user IDs with no passwords)  Each user will have its own home directory  Shell: a program assigned to user  Super-user (login name: root): super user can do ANYTHING

UNIX Users and Groups (Cont.)  Administrators should access root via ‘su’ Maintain an audit trail to identify who become root (sulog) Establish the user’s audit ID which is logged along with their current user ID when running the extended audit facilities Force administrators to perform functions that could be performed in their personal accounts  Disable ‘root’ is possible but not recommended, but should restrict ‘root’ login via Console only.

UNIX Users and Groups (Cont.)  SVRx vs. BSD version handle group in a different way  Users can only be in one group at a time  User activities are identified by user ID rather than user name  Multiple user with the same UID maybe logged in at the same time

‘Passwd’ file  ‘Passwd’ file format: User:pword:UID:GID:GECOS:home:program Passwd field should be encrypted and stored in shadow file) (For AIX and Solaris, Shadow is enabled by default, for HP-UX, shadow password is not enabled by default) All system accounts should be disabled Identify all ‘Open accounts’, accounts with no passwords Identify users with UID = ‘0’, ‘root’ with UID = ‘0’  UID< 100 system; UID 500 – 1000 application GECOS field should contain NO information

‘Passwd’ file (Cont.)  Application users should not have access to shell (identified from ‘program’ field.)

Shadow Password File  Never located in the world readable /ect/passwd file, owned by root for read/write owner only  Ensure no ‘Open accounts’  Format: lisa:x(*):1000:1000:Lisa M.:/home/lisa/bin/sh

Password Aging and Other Password Settings  No facility is provided in standard Unix  Most Unix versions provide some methods  May be vendor dependent

Group File  Path: etc/group  Format: /etc/group: group:pword:GID:user, user, user,…  Anyone knew ‘pword’ can become a member of the group, THIS SHOULD BE KEPT DISABLED  Only put users in groups created on site. Do not put individual users in groups that came with the system (e.g SAs put themselves into Sys group…)

Unix Documents Sources  System Reference Manuals  Vendor Documentatuion  Unix Books  Manual Commends Format: uname, whami, mesg, $ man

Unix Files and Directories  Each file and directory is assigned one inode: file type, file size…last modify time (mtime), last inode modified time (ctime), etc.  Ctime: related to permission change  Mtime: related to data change  Ctime vs. mtime: ‘Except for installation executables, which typically retain the vendor’s modification date, when ctime is greater than mtime, it probably indicates that a change was made to either the permissions or ownership fields.

Unix Files and Directories (cont.)  File and Directories should avoid to start with certain special characters, such as: space, tab, new line, ‘, ;, \,>,<, |,&, ?, [], *  SUID /SGID Executables Program will execute with the effective UID of the program owner instead of UID of caller Program will execute with the effective GID of the program’s group instead of GID of a caller. List all the plain files that have wither SUID or SGID permission flag set:  $ find / \ ( -perm –o –perm \) \ - type f –ls

SUID & SGID (Cont.)  Verify that all executables are provided by a trusted source.  Any changes to these executables should be authenticated (check mtime dates)  Verify that no capital S or T flags exist on executables – usually indicates bad permissions. (capital T will display is no ‘x’ is specified; S specified “mandatory locking”)  No Group or world write permissions. Possible DoS attack.

SUID & SGID (Cont.)  Investigate any user owned executables  Verify that all executables are binary files. SUID shell scripts are very dangerous. Be suspicious of small files or test with the file or type commands

Unix Files and Directories (Cont.)  “File write permission is not required to delete a file. Directory write and execute is all that is needed”  Be careful with ‘wx’ permission at directory level: back door issue. (delete a file, replace file with the same name, change owner…)

Unix Files and Directories (Cont.) umask, as the man page says, stands for User file creation mask which is used for determining the default permission for a new file creation. The new file creation could either be a file creation through a normal process or a file copy. umask command is a shell built-in meaning it is an internal command. The three file permission attributes are read, write and execute. These 3 are mapped to octal values as shown below:internal commandread, write and execute read - 4 write - 2 execute - 1

Unix Files and Directories (Cont.) In UNIX, the default file creation value is is 4+2(read + write). Permission 666 means 6 for the User, 6 for the group and 6 for others. Hence, a new file creation by default is meant to have read and write permission for User, group and others. And the default settings for directories is is (read + write + execute). This is the place where the umask comes into the picture. It is a kind of filter wherein we can choose to retain or block some of the default permissions from being applied on the file. Say, the umask value is umask is by default displayed in Octal form, and hence the first 0 in the umask value is the indication for octal value. So, the actual umask is 022. This value together with the default file value(666) decides the final permission to be given to the file. Default: 666 umask : Permission: is the permission to be given on the sample file. 644 means read and write for the User(644), read only for the group(644) and others(644).

Unix Files and Directories (Cont.)  Default File Permissions: umask Umask 022 >>> -rwxrwxr-x Umask 003 >>> -rwxrwxr— Umask 022 >>> -rwxr-xr-x Umask 023 >>> -rwxr-xr— Umask 027 >>> -rwxr-x--- good Umask 037 >>> -rwxr----- better Umask 077 >>> -rwx best

If umask value set to User permission Group permission Others permission 000all 007all none 027allread / executenone Sample umask Values and File Creation Permissions umask valueSecurity level Effective permission (directory) 022Permissive Moderate Moderate Severe700

Unix Files and Directories (cont.)  Device Files: type code ‘b’ or ‘c’ and located in ‘/dev’ or ‘devices’ firectory  Important System Directories: /etc, /bin, /usr/bin, /sbin/, /dev, /tmp, /lib, /usr/adm, /var/adm, /usr/ect, /var/etc, /usr/man, /usr/spool

Baseline  “A baseline is database of information about important system files and directories that is compared frequently against the existing system for unauthorized changes.”  “Without a properly maintained baseline and associated change control mechanism, it is impossible to assure that the system has not been compromised.” How change happened? Who made such change? Comparison should be performed on daily basis.

Permission Risk Evaluation  System Integrity (root) Can be compromised if the superuser execute a program or script that can be modified or rejected by another user  Account Integrity (e.g Oracle Database) Can be compromised if user executed program or program script can be modified or replaced by another user  Data Integrity: Data file can be modified or replaced by another user  Data Confidentiality: Data file can be read by another user

Shells and Processes  Verify that the PATH does not contain a dot or any public directories  Verify that all PATH directories are owned by the user, root or a disabled system account  Exam alias statements for alisaes to an unprotected command  Check any executed commands for proper protection

Processing Scheduling  Exam Crontab file: $1s /var/spool/cron/crontabs Cron.allow & cron.deny files At.allow & at.deny files E.g 0 2 * * * /prod/payroll/daily.backup1 Obtain a list of root’s crontab and the crontabs of any other critical user  No group or world write permissions  No user owned executables  If the executable is a script – check the script for the permissions & ownerships of the programs it executes

System Initialization  The /ect/inittab file is read and processed in sequence order by init during initialization and run level changes. Id:rrr:action:command – options parameters /ect/rc2.d (ensure no user owned executables, should be all owned by root) Plan to exam any script that was modified or added since installation for the correct permission & ownerships of the programs it executes.

Unix System Logs  Login Logs /var/adm/lastlog /etc/utmp /etc/wtmp  Su Logs E.g Su 12/10 08:30 + tty0 Lisa-root  Syslog Daemon Systlog daemon records messages from many parts of the system. System log daemon will route the message it receives according to instructions specified in the /etc/syslog.conf file.

Unix Networking  /etc/services: assignment of service to port & protocol is done with this file.  The internet daemon (inetd) initiates network services on an ‘as needed basis’, when loaded, inetd will read its list of services to manage from /etc/inetd.conf and match these services to the port number in the /etc/services file.

Unix Networking (cont.)  Remote Procedure Call Via ‘rpcinfo’ command  External Data Representation protocol  Key control files: /etc/hosts: /etc/services: (port & protocol) /etc/inetd.conf (Service – Daemon to start)

Unix Networking (cont.)  Key Files (hosts, services, inetd) Verity that these files are protected and have not been corrupted Verify that each host listed in /etc/hosts has the correct IP address and does EXIST in the network Remove every network service listed I the /etc/inetd.conf that is not required, (it is generally acceptable to leave the services in /etc/services alone as this is primary a reference file Examine the system start-up scripts for network services and remove those that are not required.

Common Network Services  Ftp Services: $HOME/.netrc: client control file for automatic login from the client to the named server, question the need fot.netrc files that contain passwords, even with owner-only read permission, they are very dangous Recommend creating a ‘ftp only’ account by giving this account a program to run like ‘/bin/false’ and then adding /bin/false to the /etc/shells files (make it not a valid shell), if.netrc is required because of the automated file transfer. List all users that should not be ‘ftp’ed to ‘ftpusers’ file, root should be included! Start the daemon with the –l option to log each login to syslog (daemon.info)

Common Network Services  Ftp (cont.) Anonymous ftp  Change /ftp/pub/ directory permissions to d—x—x—x and then name files and directories inside ‘pub’ to ‘password’ like names that only an authorized user would know  Verify that the ---/ftp/etc/passwd file does not contain any real users or passwords  Isolate the ftp home to its own file system

Common Network Services (cont.)  TFTP (Trival File Transfer Protocol) No authentication of the user, ‘get and send functions only’ Verity the service is required or ‘disabled’ Must stay in its restricted directory  Test: $ tftp hostname  tftp > get /etc/passwd If hangs, tftp is disabled Access denied, runs restricted Xxx bytes transferred : WARNING! Verify tftp runs as ‘nobody’ – check /etc/inetd.conf file

Common Network Services (cont.)  Smtp /ect/sendmail.cf – sendmail control file /ect/aliases – Mail redirection file $HOME/.forward – User forwarding file Smtp socket must run as root, the risk is that some one can take over smtp and run as root Unless it is required, smtp should be disabled If outbound mail is all that is required, remove the – bd options from the sendmail start-up command by checking system start-up script. This will allow outbound mail but disables the daemon mode. If daemon mode is required, verify that sendmail is current to all patches

Common Network Services (cont.)  Remote Execution with Telnet Telnet client.telnetrc files can be used to trace all keystrokes – Caution!

Common Network Services (cont.)  Remote Execution with rlogin and rsh Be careful with concept of ‘trusted’  Trust host  System wide trusted user  /etc/hosts.equiv and.rhost files Security Considerations:  Ban trusted users in /etc/host.equiv  Any trusted hosts in /etc/host.equiv requires that user names be consistent on client and server and that all disabled accounts be doubly disabled with /dev/null  Strongly consider banning all.rhosts files  Strongly consider replacing rlogin & rsh services with Open Secure Shell (sshd)

Common Network Services (cont.)  rlogin & rsh (cont.) If it is verified that a root.rhosts file is required, it is mandatory that trusted host(s) listed in the.rhosts file be INCLUDED in the audit because the security of the system is only as good as the security of the trusted host(s)

Common Network Services (cont.)  Remote Execution with ssh & scp Designed to replace the Berkeley “r” commands Prevent sniffing by encrypting the data exchange Assure the server contacted is the correct server Prevent ‘man in the middle’ attack Restrict account activity to a specific command by using the ‘forced command’ public key option Provide a secure channel using ‘sftp’ Provide for port forwarding which allows for better security of normal insecure data transfers such as ‘X’ windows, mail and others

Common Network Services (cont.)  SSH (cont.) Protect users’ private key Using agent may create an opportunity for ‘impersonating’ from users’ systems Disable rlogin and rcp if ssh has been implemented (e.g delete /etc/hosts.equiv file and replace with /ect/shosts.equiv file)

Network File Sharing (NFS)  Control files: Server: /etc/exports or /etc/dfs/dfstab (several control files listing the directories and restrictions) Client: /etc/fstab or /etc/vfstab or /etc/filesystms (client control file listing the directories and mount options)

Network File Sharing (NFS) (Cont.)  Security Considerations: The client must mount the directory as ‘nosuid’ to prevent possible server attack Consistent network wide UIDs and GIDs Servers must export the directory to only authorized clients to prevent unauthorized mount. (always use ‘access = option’ in /etc/exports file Avoid client root access unless read-only (anon = or root = value in the server control file) Avoid exporting system or critical directories unless read-only

Unix Based System Comparison  Using of restrict shell AIX: /usr/bin/Rsh Solaris: /usr/bin/rksh HP-UX: /usr/bin/rksh Tru64: /usr/bin/Rsh Linux**: /usr/bin/bash –r Others: check manual for ksh

Unix Based System Comparison (Cont.)  Access Control List AIX: $ acledit myfile HP-UX: chacl Tru64: setacl Solaris + Linux: setfacl

Unix Based System Comparison (Cont.) Unix System Comparison

Q? Thank You!