cscd 303 - ewupenguin.ewu.edu/cscd303/coursenotes/cscd303-lecture6-window-security... · 10...

98
CSCD 303 Essential Computer Security Fall 2017 Lecture 6 - Windows Security Access Control/Authentication Reading: Chapter 5, CompTIA text

Upload: trinhhuong

Post on 22-Aug-2019

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

CSCD 303Essential Computer Security Fall 2017

Lecture 6 - Windows Security

– Access Control/AuthenticationReading: Chapter 5, CompTIA text

Page 2: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Overview

•Learning Objectives– History of Windows Security– Learn about Windows Security Components

• Authentication• Access Control• Privileges

Page 3: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Security

Windows is the world’s most popular O/S Advantage is that security enhancements

can protect millions of nontechnical users Challenge is that vulnerabilities in

Windows can also affect millions of users Review overall security architecture of

Windows 2000 and later Look at Security defenses built into

Windows

Page 4: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

History In 1988, Microsoft created “new technology” (NT) portable operating system - supported both OS/2 and POSIX API's. NT supported servers and desktop workstations.

During development NT was changed to use the Win32 API, reflecting the popularity of the Windows 3.0 Win16 API

Windows XP was released in 2001 - replace earlier versions of Windows based on MS/DOS, such as Windows98 and Windows ME.

Windows XP updated in 2005 to provide support AMD64 compatible CPUs, bringing support for 64-bit desktop systems.

Windows Vista was released in late 2006, but was poorly received due to initial problems with application and device compatibility

Windows 7 was released in late 2009, greatly improving on Vista. Windows 8 was released in October 2012. Not well received.

Windows 10 was first released on July 29, 2015. Windows 10 introduces "universal apps"; Apps can be designed to run across multiple Microsoft product families with nearly identical code ‍

Page 5: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Operating System Market Share

Page 6: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Background: Windows• Advantages

– User friendly– Enhancements can help millions of users– Defects found quickly because of widespread use

• Disadvantages– Security defects can leave millions vulnerable– Non-technical user-base– Industry dominance leaves MS handcuffed - any

move to expand capabilities seen as anticompetitive– Forced to support legacy code and systems

Page 7: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Security Architecture• Local Security Authority • Security Reference Monitor• Security Account Manager• Active Directory• Local vs. Domain Accounts• Access Control Lists• Integrity Control • User Account Controls

Page 8: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

8

Security Components

hardware interfaces (buses, I/O devices, interrupts, interval timers, DMA, memory cache control, etc., etc.)

System Service Dispatcher

Original copyright by Microsoft Corporation. Used by permission.

SystemThreads

UserMode

KernelMode

NtosKrnl.Exe

Ob

jectM

gr.

WindowsUSER,

GDI

File

Syste

m C

ache

I/O Mgr

Device &File Sys.Drivers

Plu

g an

dP

lay Mg

r.

Po

wer

Mg

r.

Secu

rityR

eference

Mo

nito

r

Virtu

alM

emo

ry

Pro

cesses&

Th

reads

Lo

calP

roced

ure

Call Graphics

Drivers

Kernel

Hardware Abstraction Layer (HAL)

(kernel mode callable interfaces)

Co

nfig

ura-

tion

Mg

r(reg

istry)

WinLogonMSGINA

LSASSActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Page 9: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Security Reference Monitor (SRM)• Kernel Mode Component that

– Performs Access Checks

– Generates Audit Log Entries

– Manipulates User Privileges

Group of functions in Ntoskrnl.exe– Some functions documented in DDK

(Windows Driver Devolopment Kit)

– Exposed to user mode by Windows API calls

Page 10: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10

Security Components

Local Security Authority User-mode process (\Windows\System32\Lsass.exe) that implements policies (e.g. password, logon), authentication, and sending audit records to the security event log

LSASS policy database: registry key HKLM\SECURITY

WinLogonMSGINA LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Page 11: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Local Security Authority (LSA)• Responsible for enforcing

local security policy– Lsass.exe– Runs in User mode

• Issues security tokens to accounts

• Key component of the logon process

Continuously runs as a process

Page 12: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

LSASS ComponentsSecurity Account Manager (SAM)

• A database that stores user accounts and local users and groups security information

• SamSrv.exe

Page 13: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

LSASS ComponentsActive Directory

• Directory Service– Server-based

authentication, non-local– Centrally managed by a

domain controller

Page 14: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

14

LSASS ComponentsActive Directory

A directory service contains database that stores information about objects in a domain

A domain is a collection of computers and their associated security groups that are managed as a single entity

Active Directory server, implemented as a service, \Windows\System32\Ntdsa.dll, that runs in the Lsass process

Authentication packages DLLs that run in context of Lsass process and that implement Windows authentication policy:

LanMan: \Windows\System32\Msvc1_0.dll

Kerberos: \Windows\System32\Kerberos.dll

Negotiate: uses LanMan for local machine or Kerberos, for domain machine

Page 15: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

15

LSASS ComponentsNet Logon Service (Netlogon)

A Windows service (\Windows\System32\Netlogon.dll) that runs inside Lsass and responds to Microsoft LAN Manager 2 Windows NT (pre-Windows 2000) network logon requests

Authentication is handled as local logons are, by sending them to Lsass for verification

Netlogon also has a locator service built into it for locating domain controllers

WinLogon

MSGINA LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Page 16: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

16

Security ComponentsLogon process (Winlogon)

A user-mode process running \Windows\System32\Winlogon.exe that is responsible for responding to the LSASS and for managing interactive logon sessions

Graphical Identification and Authentication (GINA) A user-mode DLL that runs in the Winlogon process and that Winlogon uses to obtain a user's name and password or smart card PIN - Default is \Windows\System32\Msgina.dll

WinLogon

MSGINA

LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dllLSA

Policy

Event Logger

ActiveDirectory

SAM

Page 17: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

17

Local Logon

MSGINA

MSV1_0

LSASS

LPC

Winlogon

SAMSRV

Page 18: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

18

Winlogon

MSGINA

Kerberos

LSASS

NTDSA

LSASS

LPC

Domain Controller

Local Machine

Remote Logon - Active Directory

If the logon is for a domain account, the encrypted credentials are sent to LSASS on the domain controller:

Active

Directory

Page 19: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Local vs. Domain Accounts• Local Accounts for computers not hooked

up to a network• Networked computers can be either:

● Workgroup joined ● Domain joined

Page 20: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Workgroup Joined• A collection of computers connected

together• Only local accounts in SAM can be used • No infrastructure to support AD

Page 21: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Domain Joined• Share access to networked printers, file

servers, etc.• Centrally Managed

– More secure– Scalable

Page 22: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

User Management, Tokens and

Access Control Lists

Page 23: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Login Example

• Administrator creates a user account (full name, username, password, group, privileges)• Windows creates an Security ID (SID)

– S-1-5-21-AAA-BBB-CCC-RRR • In windows, username can be in two formats

– SAM format: support by all versions of Windows (legacy format)

• Form: DOMAIN/username

– User Principle Name (UPN) and looks more like RFC822 email address

• Example: [email protected]

Page 24: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

24

Security Identifiers - SIDsWindows uses Security Identifers (SIDs) to identify security principles:

Users, Groups of users, Computers and Domains

SIDs consist of: Example: S-1-5-21-3196711-41413171-350571-1000

A revision level e.g. 1

An identifier-authority value e.g. 5 (SECURITY_NT_AUTHORITY)

One or more subauthority values, predifined

SIDs are generally long enough to be globally statistically unique

Setup assigns a computer an SID

Users and groups on the local machine are assigned SIDs that are rooted with the computer SID, with a Relative Identifier (RID) at the end

Some local users and groups have pre-defined SIDs (eg. World = S-1-1-0)

RIDs start at 1000 (built-in account RIDs are pre-defined)

Page 25: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Security Identifiers (SIDs)

User account

has SID that uniquely

identifies it

Page 26: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Login ExampleAssuming Active Directory• User: FredMgr

• User logs in with keyboard

• Information is sent to the AD (domain controller)

• If successful, – User name and password or other authentication is

good,

– Token is generated and sent to user

• Token contains

– User’s SID

– Group membership

– Privileges

Page 27: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Login Example

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: None

Security Token

Page 28: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

The Token Whats in a token? Contains a list of Security ID's associated with a user account

• You can have multiple SIDs because you belong to multiple groups

• So, when user tries to access a resource such as a file, token is used for access control

How is token used?• Object, say a file will have an Access

Control List (ACL) that specifies SID's permitted to access the object

• If one of SID's in users token matches SID in Object's ACL, user granted access

Page 29: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Access Control List (ACL)• Access to objects in Windows is through

Discretinary ACL's• Discretionary ACL

– Grants or denies access to protected resources such as files, shared memory, etc.

• System ACL– Used for auditing and to enforce mandatory

integrity policy (Vista)

Page 30: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Access Control Lists (ACL) (continued)

• Objects needing protection are assigned an ACL that includes– SID of object owner– List of access control entries (ACEs)

• Each ACE includes a SID and Access Mask– Access mask could include

• Read, Write, Create, Delete, Modify, etc.

Page 31: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Access Control Example• User opens text file

Page 32: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

32

Protecting ObjectsAccess to an object is through Security Reference Monitor (SRM),

Performs access validation at time object is opened by a process

Access validation has following components:Desired Access: Type of access

Must be specified up front,

Include all accesses performed on the object as a result of the validation.

Token: Identifies the User that owns the process, Plus user privileges

The object’s Security Descriptor

Contains a Discretionary Access Control List (DACL),Describes the types of access to the object users are allowed.

Page 33: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

33

Security DescriptorsDescriptors are associated with objects: e.g. files, Registry keys, application-defined

Descriptors are variable length

Primary Group

DACL pointer

Owner SID

SACL pointer

DACL

SACL

Defined for POSIX

Page 34: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

34

Discretionary Access Control Lists DACLs

DACLs consist of zero or more Access Control Entries

A security descriptor with no DACL allows all access

A security descriptor with an empty (0-entry) DACL denies everybody all access

An ACE is either “allow” or “deny”

Read, Write,Delete, ...

SID

Access Mask

ACE Type

Page 35: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

35

Access CheckACEs in the DACL are examined in order

Does the ACE have a SID matching a SID in the token?

If so, do any of the access bits match any remaining desired accesses?

If so, what type of ACE is it?

Deny: return ACCESS_DENIED

Allow: grant the specified accesses and if there are no remaining accesses to grant, return ACCESS_ALLOWED

If we get to the end of the DACL and there are remaining desired accesses from the user, return ACCESS_DENIED

Page 36: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

36

Example: Access granted

Security Token

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: NoneDesired access

read/write

File object

Security descriptor

AccessAllowedFredMgrRead (RX)

AccessAllowedMgrsSpecial Access(RW)

AccessAllowedEveryoneSpecial Access(X)

ACE ACE ACE

Discretionary Access Control List

Page 37: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

37

Example: Access denied

Security Token

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: NoneDesired access

read/write

File object

Security descriptor

AccessDeniedMgrs (No Access)

AccessAllowedFredMgrRead(RX)

AccessAllowedEveryoneWrite(W)

ACE ACE ACE

Discretionary Access Control List

Page 38: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

38

Access Check Quiz

ObjectAuthors

Read

Deny

Mark

All

Allow

Authors

Developers

Privilege 1

Privilege n

Mark

Write

Token

DACL

Access Request

Is Mark allowed write access?Is Mark allowed write access?

yesyes

Page 39: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

39

Access Special Cases

An object’s owner can always open an object with WRITE and READ permission

An account with “take ownership” privilege can claim ownership of any object

An account with backup privilege can open any file for reading even if all others are denied, Why?

An account with restore privilege can open any file for write access

Page 40: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

40

PrivilegesSpecify which system actions a process (or thread) can perform

Privileges are associated with groups and user accounts

There are sets of pre-defined privileges associated with built-in groups (e.g. System, Administrators)

Examples include:

Backup/Restore

Shutdown

Debug

Take ownership

Page 41: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

41

Difference Between Privilege and Permission

Permisson− Implies consent to user group to

perform an action

− Property of an object, r,w,x, modify

Privilege− Permission given to user or group

− Is a property of an agent / user and lets them do things which are not ordinarily allowed

Page 42: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Privilege Levels

• Vista, Windows 7 on Up– Users have more choices

– Can operate as a restricted normal user and still be able to do almost everything in OS

– And when necessary, you can be elevated to an administrator for a short time to accomplish some task

– Called UAC – User Account Control• Still alive and well in Windows 10

https://docs.microsoft.com/en-us/windows/access-protection/user-account-control/how-user-account-control-works

Page 43: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

User Account Control

What does it do? UAC allows an administrator to enter credentials

during a non-administrator's user session Perform occasional administrative tasks without

having to switch users, log off, or use the Run as command

UAC can also require administrators to specifically approve applications that will make "system-wide" changes before those applications are allowed to run

Page 44: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

User Account Control

Windows Vista and 7, how it works: Admin Approval Mode (AAM), by default, is

not enabled for the Built-in Administrator Account in Windows Vista or 7

Built-in Administrator Account is disabled by default in Windows Vista, and first user account created is placed in local Administrators group, and AAM is enabled for that account

Page 45: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Benefits of UAC

What does it do for you? Admin Approval Mode helps prevent malicious

programs from silently installing without an administrator's knowledge

It also helps protect from inadvertent system-wide changes

Lastly, it can be used to enforce a higher level of compliance

– Administrators must actively consent or provide credentials for each administrative process

Page 46: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Tasks Only Administrators Can Perform

Create, change, and delete user accounts and groups Install and uninstall programs Configure automatic updating or install Windows updates manually Install an ActiveX control Install or remove hardware device drivers Share folders Set permissions Access all files, including those in another user’s folder Take ownership of files Copy or move files into the %ProgramFiles% or %SystemRoot%

folders Restore backed-up system files Grant rights to other user accounts and to themselves Configure Parental Controls Configure Windows Firewall

Page 47: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Tasks Available to Standard Users

Change the password and picture for their own user account

Use programs that have been installed on the computer Install approved ActiveX controls Configure a secure Wi-Fi connection View permissions Create, change, and delete files in their document

folders and in shared document folders Restore their own backed-up files View the system clock and calendar, and change the

time zone Configure power options Log on in Safe Mode

Page 48: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Summary

Windows Operating Systems by design Is genuinely trying to operate securely

Users and processes have access to resources through security mechanisms– Mostly Discretionary Access control through their

identities and group affiliations

Want concept of Least Privilege to be in effect User Account Control assists with that in Windows

– Like “sudo” in Linux

– Helps with restricting access to system resources

Page 49: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

The End

• Next Time: More Desktop• Check for the lab

– It will be a Kali Linux Install lab

Page 50: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 51: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 52: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 3

Windows Security

Windows is the world’s most popular O/S Advantage is that security enhancements

can protect millions of nontechnical users Challenge is that vulnerabilities in

Windows can also affect millions of users Review overall security architecture of

Windows 2000 and later Look at Security defenses built into

Windows

Windows is the world’s most popular operating system and as such has a number of interesting security-related advantages and challenges. The major advantage is any security advancement made to Windows can protect hundreds of millions of nontechnical users, and advances in security technologies can be used by thousands of corporations to secure their assets. The challenges for Microsoft are many, including the fact that security vulnerabilities in Windows can affect millions of users. Of course, there is nothing unique about Windows having security vulnerabilities; all software products have security bugs. However, Windows is used by so many nontechnical users that Microsoft has some interesting engineering challenges. This chapter begins with a description the overall security architecture of Windows 2000 and later. It is important to point out that versions of Windows based on the Windows 95 code base,including Windows 98, Windows 98 SE, and Windows Me, had no real security model, in contrast to Windows NT and later versions. The Windows 9x codebase is no longer supported. The remainder of the chapter cover the security defenses built into Windows, most notably the new defenses in Windows Vista.

Page 53: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

4

10/09/17 4

History In 1988, Microsoft created “new technology” (NT) portable operating system - supported both OS/2 and POSIX API's. NT supported servers and desktop workstations.

During development NT was changed to use the Win32 API, reflecting the popularity of the Windows 3.0 Win16 API

Windows XP was released in 2001 - replace earlier versions of Windows based on MS/DOS, such as Windows98 and Windows ME.

Windows XP updated in 2005 to provide support AMD64 compatible CPUs, bringing support for 64-bit desktop systems.

Windows Vista was released in late 2006, but was poorly received due to initial problems with application and device compatibility

Windows 7 was released in late 2009, greatly improving on Vista. Windows 8 was released in October 2012. Not well received.

Windows 10 was first released on July 29, 2015. Windows 10 introduces "universal apps"; Apps can be designed to run across multiple Microsoft product families with nearly identical code ‍

Page 54: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 5

Operating System Market Share

Page 55: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

6

Background: Windows• Advantages

– User friendly– Enhancements can help millions of users– Defects found quickly because of widespread use

• Disadvantages– Security defects can leave millions vulnerable– Non-technical user-base

– Industry dominance leaves MS handcuffed - any move to expand capabilities seen as anticompetitive

– Forced to support legacy code and systems

Page 56: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

7

Windows Security Architecture• Local Security Authority • Security Reference Monitor• Security Account Manager• Active Directory• Local vs. Domain Accounts• Access Control Lists• Integrity Control • User Account Controls

Anyone who wants to understand windows security must have knowledge of the basic fundamental security blocks of security system.

There are many components in windows that make up the fundamental security infrastructure.

Page 57: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

8

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze8

Security Components

hardware interfaces (buses, I/O devices, interrupts, interval timers, DMA, memory cache control, etc., etc.)

System Service Dispatcher

Original copyright by Microsoft Corporation. Used by permission.

SystemThreads

UserMode

KernelMode

NtosKrnl.Exe

Ob

jectM

gr.

WindowsUSER,

GDI

File

System

Ca

che

I/O Mgr

Device &File Sys.Drivers

Plu

g an

dP

lay Mg

r.

Po

wer

Mg

r.

Sec

urity

Referen

ceM

on

itor

Virtu

alM

emo

ry

Pro

cesse

s&

Th

read

s

Lo

calP

roced

ure

Call Graphics

Drivers

Kernel

Hardware Abstraction Layer (HAL)

(kernel mode callable interfaces)

Co

nfig

ura-

tion

Mg

r(reg

istry)

WinLogonMSGINA

LSASSActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Red boxes are security-related processes and blue are the security-related databases and DLLs.

Page 58: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

9

Security Reference Monitor (SRM)• Kernel Mode Component that

– Performs Access Checks

– Generates Audit Log Entries

– Manipulates User Privileges

Group of functions in Ntoskrnl.exe– Some functions documented in DDK

(Windows Driver Devolopment Kit)

– Exposed to user mode by Windows API calls

Its kernel mode component that performs access checks, generates audit log entities, and manipulates user privileges

Simply put it checks for proper authorization before granting access to objects

Object manager is client of SRM: It asks SRM if the process has the proper rights to execute a certain type of action on an object

Uses Access Control Lists to do this, which we will cover later in this presentation

Implement auditing function to keep track of attempts to access an object

Implements DoD C2 level security: Department of Defense: C2 Level Security:

The following list includes some of the most important requirements of C2-level security, as defined by the U.S. Department of Defense:

•It must be possible to control access to a resource by granting or denying access to individual users or named groups of users.

•Memory must be protected so that its contents cannot be read after a process frees it. Similarly, a secure file system, such as NTFS, must protect deleted files from being read.

•Users must identify themselves in a unique manner, such as by password, when they log on. All auditable actions must identify the user performing the action.

•System administrators must be able to audit security-related events. However, access to the security-related events audit data must be limited to authorized administrators.

•The system must be protected from external interference or tampering, such as modification of the running system or of system files stored on disk.

Page 59: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze10

Security Components

Local Security Authority User-mode process (\Windows\System32\Lsass.exe) that implements policies (e.g. password, logon), authentication, and sending audit records to the security event log

LSASS policy database: registry key HKLM\SECURITY

WinLogonMSGINA LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Red boxes are security-related processes and blue are the security-related databases and DLLs.

Page 60: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

11

Local Security Authority (LSA)• Responsible for enforcing

local security policy– Lsass.exe– Runs in User mode

• Issues security tokens to accounts

• Key component of the logon process

Continuously runs as a process

Resides in user-mode process named lsass.exe and is responsible for enforcing local security policy in windows.

Responsible for validating users for both local and remote logon

Issues security tokens to accounts as they log on to the system

Security policy includes

Password policy (complexity rules …expiration times etc.)

Auditing policy and privilege settings

During the local (interactive) logon to a machine, a person enters their name and password to the logon dialog. This information is passed to the LSA, which then calls the appropriate authentication package. The password is sent in a nonreversible secret key format using a one-way hash function. The LSA then queries the SAM database for the user's account information. If the key provided matches the one in the SAM, the SAM returns the users SID and the SIDs of any groups the user belongs to. The LSA then uses these SIDs to generate the security access token.

Was successfully exploited in the Sasser worm (by an 18 year old German student) :2004

Page 61: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

12

LSASS ComponentsSecurity Account Manager (SAM)

• A database that stores user accounts and local users and groups security information

• SamSrv.exe

Database that stores user accounts and relevant security information about local users and local groups

Accounts Manager (SAM) is a registry file

Stores users' passwords in a hashed format

When a user logs on to a computer using a local account, the SAM process (Samsrv) takes the logon information and performs a lookup against the SAM database, which resides in the windows system32/config directory(Something similar in UNIX, think etc/password). If credential match, then the user can log on to the system, assuming there are no other factors preventing logon, such as logon time restrictions or privilege issues.

Note that SAM does not perform the logon; that is the job of the LSA.

The SAM file is binary rather than text and passwords are stored using the MD4 hash algorithms. On windows vista, the SAM stores password information using a password-based key derivation function (PBKCS).

In an attempt to improve the security of the SAM database against offline software cracking, Microsoft introduced the SYSKEY function in Windows NT 4.0. When SYSKEY is enabled, the on-disk copy of the SAM file is partially encrypted, so that the password hash values for all local accounts stored in the SAM are encrypted with a key (usually also referred to as the "SYSKEY").

In the case of online attacks, it is not possible to simply copy the SAM file to another location. The SAM file cannot be moved or copied while Windows is running, since the Windows kernel obtains and keeps an exclusive filesystem lock on the SAM file, and will not release that lock until the operating system has shut down or a blue screen exception has been thrown. However, the in-memory copy of the contents of the SAM can be dumped using various techniques, making the password hashes available for offline brute-force attack.

Page 62: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

13

LSASS ComponentsActive Directory

• Directory Service– Server-based

authentication, non-local– Centrally managed by a

domain controller

A directory service used to store information about the network resources across a domain and also centralizes the network.

Server based authentication

Centrally managed

Its microsofts’s LDAP directory included with window server 2000 and later.

All client versions of windows, including windows XP and windows Vista, can communicate with AD to perform security operations including account logon

Windows client will authenticate using AD when the user logs on to the computer using a domain account rather than a local account.

Like the SAM scenario, the user’s credential information sent securely across the network, verified by AD, and then if the information is correct, the user can Logon.

Page 63: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze14

LSASS ComponentsActive Directory

A directory service contains database that stores information about objects in a domain

A domain is a collection of computers and their associated security groups that are managed as a single entity

Active Directory server, implemented as a service, \Windows\System32\Ntdsa.dll, that runs in the Lsass process

Authentication packages DLLs that run in context of Lsass process and that implement Windows authentication policy:

LanMan: \Windows\System32\Msvc1_0.dll

Kerberos: \Windows\System32\Kerberos.dll

Negotiate: uses LanMan for local machine or Kerberos, for domain machine

Page 64: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze15

LSASS ComponentsNet Logon Service (Netlogon)

A Windows service (\Windows\System32\Netlogon.dll) that runs inside Lsass and responds to Microsoft LAN Manager 2 Windows NT (pre-Windows 2000) network logon requests

Authentication is handled as local logons are, by sending them to Lsass for verification

Netlogon also has a locator service built into it for locating domain controllers

WinLogon

MSGINA LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dll

LSAPolicy

Event Logger

ActiveDirectory

SAM

Page 65: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze16

Security ComponentsLogon process (Winlogon)

A user-mode process running \Windows\System32\Winlogon.exe that is responsible for responding to the LSASS and for managing interactive logon sessions

Graphical Identification and Authentication (GINA) A user-mode DLL that runs in the Winlogon process and that Winlogon uses to obtain a user's name and password or smart card PIN - Default is \Windows\System32\Msgina.dll

WinLogon

MSGINA

LSASS

NetLogonActive

Directory

LSA Server

SAM Server

MSVC1_0.dl

Kerberos.dllLSA

Policy

Event Logger

ActiveDirectory

SAM

Page 66: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze17

Local Logon

MSGINA

MSV1_0

LSASS

LPC

Winlogon

SAMSRV

Page 67: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze18

Winlogon

MSGINA

Kerberos

LSASS

NTDSA

LSASS

LPC

Domain Controller

Local Machine

Remote Logon - Active Directory

If the logon is for a domain account, the encrypted credentials are sent to LSASS on the domain controller:

Active

Directory

Page 68: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

19

Local vs. Domain Accounts

• Local Accounts for computers not hooked up to a network

• Networked computers can be either:● Workgroup joined ● Domain joined

Networked windows computer can be one of two configuration either domain joined or workgroup

Difference between a workgroup and a domain is simply where accounts are authenticated

The workgroup has no domain controllers; authentication is performed on each computer, and a domain authenticates accounts at domain controllers running AD

Page 69: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

20

Workgroup Joined

• A collection of computers connected together

• Only local accounts in SAM can be used • No infrastructure to support AD

Wokgroup: when computer is workgroup, only local accounts can be used, held in the SAM

Notion of workgroup smipy a collection of computers connected to one another using a network; but rather using central database of accounts in AD, the machines use only local accounts

Page 70: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

21

Domain Joined

• Share access to networked printers, file servers, etc.

• Centrally Managed– More secure– Scalable

Domain joined: user can gain access to the computer using domain accounts, which are centrally managed in active directory

If they wish also can log on using local accounts but local accounts may not have access to domain resources such as networked printers, web servers, email servers and so on

Pros and Cons to each scenario

Domain has major advantage of being centrally managed; as such is much more secure

If environment has 1000 computers and an employee leaves, the user’s account can be disabled centrally rather than on 1000 individual computer

Only advantage of using local accounts is that a computer does not need the infrastructure required to support a domain using AD

Page 71: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

22

User Management, Tokens and

Access Control Lists

Page 72: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

23

Windows Login Example

• Administrator creates a user account (full name, username, password, group, privileges)• Windows creates an Security ID (SID)

– S-1-5-21-AAA-BBB-CCC-RRR

• In windows, username can be in two formats– SAM format: support by all versions of Windows

(legacy format)• Form: DOMAIN/username

– User Principle Name (UPN) and looks more like RFC822 email address

• Example: [email protected]

now we know the basic elements that makes up the core windows security infrastructure. Lets go over example when user logs on to a windows system

before a user log on to windows network, domain administrator must add user’s account information to the system; this will include username, account name(must be unique), password

optionally the admin can grant group membership and privileges

Windows creates an SID in the form ofS-1-5-21-AAA-BBB-CCC-RRR

S : means SID1: SID version number5: identifier authority 21: means not unique , which just means there is no guarantee of uniqueness, a SID is unique within a domain AAA-BBB-CCC: unique number representing domainRRR: called relative ID (RID) ; its unique number that increments by 1 as each SID unique

In windows, username can be in two formatsSAM format: support by all versions of Windows (legacy format)

Form: DOMAIN/usernameUser Principle Name (UPN) and looks more like RFC822 email address

Example: [email protected]

Page 73: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze24

Security Identifiers - SIDsWindows uses Security Identifers (SIDs) to identify security principles:

Users, Groups of users, Computers and Domains

SIDs consist of: Example: S-1-5-21-3196711-41413171-350571-1000

A revision level e.g. 1

An identifier-authority value e.g. 5 (SECURITY_NT_AUTHORITY)

One or more subauthority values, predifined

SIDs are generally long enough to be globally statistically unique

Setup assigns a computer an SID

Users and groups on the local machine are assigned SIDs that are rooted with the computer SID, with a Relative Identifier (RID) at the end

Some local users and groups have pre-defined SIDs (eg. World = S-1-1-0)

RIDs start at 1000 (built-in account RIDs are pre-defined)

Page 74: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 75: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

26

Windows Login ExampleAssuming Active Directory• User: FredMgr

• User logs in with keyboard

• Information is sent to the AD (domain controller)

• If successful, – User name and password or other authentication is

good,

– Token is generated and sent to user

• Token contains

– User’s SID

– Group membership

– Privileges

Page 76: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

27

Windows Login Example

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: None

Security Token

Page 77: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 28

The Token Whats in a token? Contains a list of Security ID's associated with a user account

• You can have multiple SIDs because you belong to multiple groups

• So, when user tries to access a resource such as a file, token is used for access control

How is token used?• Object, say a file will have an Access Control

List (ACL) that specifies SID's permitted to access the object

• If one of SID's in users token matches SID in Object's ACL, user granted access

Page 78: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

29

Access Control List (ACL)

• Access to objects in Windows is through Discretinary ACL's

• Discretionary ACL– Grants or denies access to protected

resources such as files, shared memory, etc.

• System ACL– Used for auditing and to enforce mandatory

integrity policy (Vista)

An ACL is a list of permissions attached to an object

The list specifies who or what is allowed to access the object and what operations are allowed to be performed on the object.

Windows has two forms of access control list

Discretionary ACL (DACL):

Grants and denies access to protected resources in windows such as files, shared memory

System ACL (SACL)

Used for auditing and in windows vista used to enforce mandatory integrity policy

Objects that requires protection are assigned a DACL (and possible SACL), which includes SID of object owner as well as a list of access control entries (ACEs)

Each ACE includes a SID and an access mask

Access mask could include an ability to read, write, create, delete , modify and so on

Page 79: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

30

Access Control Lists (ACL) (continued)

• Objects needing protection are assigned an ACL that includes– SID of object owner– List of access control entries (ACEs)

• Each ACE includes a SID and Access Mask– Access mask could include

• Read, Write, Create, Delete, Modify, etc.

Page 80: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

31

Access Control Example• User opens text file

Page 81: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze32

Protecting ObjectsAccess to an object is through Security Reference Monitor (SRM),

Performs access validation at time object is opened by a process

Access validation has following components:Desired Access: Type of access

Must be specified up front,

Include all accesses performed on the object as a result of the validation.

Token: Identifies the User that owns the process, Plus user privileges

The object’s Security Descriptor

Contains a Discretionary Access Control List (DACL),Describes the types of access to the object users are allowed.

Page 82: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze33

Security DescriptorsDescriptors are associated with objects: e.g. files, Registry keys, application-defined

Descriptors are variable length

Primary Group

DACL pointer

Owner SID

SACL pointer

DACL

SACL

Defined for POSIX

Page 83: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze34

Discretionary Access Control Lists DACLs

DACLs consist of zero or more Access Control Entries

A security descriptor with no DACL allows all access

A security descriptor with an empty (0-entry) DACL denies everybody all access

An ACE is either “allow” or “deny”

Read, Write,Delete, ...

SID

Access Mask

ACE Type

Page 84: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze35

Access CheckACEs in the DACL are examined in order

Does the ACE have a SID matching a SID in the token?

If so, do any of the access bits match any remaining desired accesses?

If so, what type of ACE is it?Deny: return ACCESS_DENIED

Allow: grant the specified accesses and if there are no remaining accesses to grant, return ACCESS_ALLOWED

If we get to the end of the DACL and there are remaining desired accesses from the user, return ACCESS_DENIED

Page 85: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze36

Example: Access granted

Security Token

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: NoneDesired access

read/write

File object

Security descriptor

AccessAllowedFredMgrRead (RX)

AccessAllowedMgrsSpecial Access(RW)

AccessAllowedEveryoneSpecial Access(X)

ACE ACE ACE

Discretionary Access Control List

Page 86: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze37

Example: Access denied

Security Token

Used ID: FredMgrGroup Ids: Users

MgrsEveryone

Privileges: NoneDesired access

read/write

File object

Security descriptor

AccessDeniedMgrs (No Access)

AccessAllowedFredMgrRead(RX)

AccessAllowedEveryoneWrite(W)

ACE ACE ACE

Discretionary Access Control List

Page 87: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

38

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze38

Access Check Quiz

ObjectAuthors

Read

Deny

Mark

All

Allow

Authors

Developers

Privilege 1

Privilege n

Mark

Write

Token

DACL

Access Request

Is Mark allowed write access?Is Mark allowed write access?

yesyes

The first ACE does not apply to the access check since Mark is requesting WRITE access, but the ACE controls READ access. The second ACE does apply since WRITE is a subset of ALL.

Note that WRITE does not imply READ. The security system does not understand the semantics of different access types, just their bit representations.

Page 88: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

39

Access Special Cases

An object’s owner can always open an object with WRITE and READ permission

An account with “take ownership” privilege can claim ownership of any object

An account with backup privilege can open any file for reading even if all others are denied, Why?

An account with restore privilege can open any file for write access

Page 89: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze40

PrivilegesSpecify which system actions a process (or thread) can perform

Privileges are associated with groups and user accounts

There are sets of pre-defined privileges associated with built-in groups (e.g. System, Administrators)

Examples include:

Backup/Restore

Shutdown

Debug

Take ownership

Page 90: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze41

Difference Between Privilege and Permission

Permisson

− Implies consent to user group to perform an action

− Property of an object, r,w,x, modify

Privilege

− Permission given to user or group

− Is a property of an agent / user and lets them do things which are not ordinarily allowed

Page 91: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 92: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 43

User Account Control

What does it do? UAC allows an administrator to enter credentials

during a non-administrator's user session Perform occasional administrative tasks without

having to switch users, log off, or use the Run as command

UAC can also require administrators to specifically approve applications that will make "system-wide" changes before those applications are allowed to run

Page 93: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 44

User Account Control

Windows Vista and 7, how it works: Admin Approval Mode (AAM), by default, is

not enabled for the Built-in Administrator Account in Windows Vista or 7

Built-in Administrator Account is disabled by default in Windows Vista, and first user account created is placed in local Administrators group, and AAM is enabled for that account

Page 94: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

10/09/17 45

Benefits of UAC

What does it do for you? Admin Approval Mode helps prevent malicious

programs from silently installing without an administrator's knowledge

It also helps protect from inadvertent system-wide changes

Lastly, it can be used to enforce a higher level of compliance

– Administrators must actively consent or provide credentials for each administrative process

Page 95: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 96: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)
Page 97: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)

48

Summary

Windows Operating Systems by design Is genuinely trying to operate securely

Users and processes have access to resources through security mechanisms– Mostly Discretionary Access control through their

identities and group affiliations

Want concept of Least Privilege to be in effect User Account Control assists with that in Windows

– Like “sudo” in Linux

– Helps with restricting access to system resources

Page 98: CSCD 303 - EWUpenguin.ewu.edu/cscd303/CourseNotes/CSCD303-Lecture6-Window-Security... · 10 Security Components Local Security Authority User-mode process (\Windows\System32\Lsass.exe)