Net Security Jim Fawcett CSE 686 Internet Programming

  • Slides: 45
Download presentation
. Net Security Jim Fawcett CSE 686 – Internet Programming Summer 2005

. Net Security Jim Fawcett CSE 686 – Internet Programming Summer 2005

References n n n Developmentor Slides from MSDNAA, Keith Brown Introduction to Evidence-based Security

References n n n Developmentor Slides from MSDNAA, Keith Brown Introduction to Evidence-based Security in. Net Framework, Brad Merrill, http: //www. dcl. hpi. unipotsdam. de/LV/Components 04/VL 7/05 a_Securitydetailed. pdf Securing, Deploying and Maintaining. Net Applications, Patrick Tisseghem, www. u 2 u. net

Agenda n n n Threats Windows Role-Based Security Code Access Security

Agenda n n n Threats Windows Role-Based Security Code Access Security

Basic Security Issues n Confidentiality n n Integrity n n Identify a user securely

Basic Security Issues n Confidentiality n n Integrity n n Identify a user securely Authorization n n Decide who has access to information and how to make access effective Authentication n n Ensure that data is not modified without authorization Availability n n Disclose information only to authorized users Define a set of allowed actions for authorized users Non repudiation n Log users, their actions, and the objects used.

Threats n Stride model n n n Spoofing identity Tampering with data Repudiation Information

Threats n Stride model n n n Spoofing identity Tampering with data Repudiation Information disclosure Denial of service Elevation of priviledge

Mitigating Threats n Protection n Detection n n Make successful threats difficult Virtually always

Mitigating Threats n Protection n Detection n n Make successful threats difficult Virtually always possible for attacks to succeed in complex systems if the attacker has enough resources Detect an attack in progress Response n Put in place plans for each identified threat type

Spoofing n Attacker claims false identity n Claim client identity § § § n

Spoofing n Attacker claims false identity n Claim client identity § § § n Gain access to sensitive data Run dangerous processes on server Gain administrative priviledges Claim server identity § Collect sensitive data from clients § Provide false data to clients n Protection n Strong authentication using crytography

Tampering with Data n Tampering with persistent data n n n n Modify password

Tampering with Data n Tampering with persistent data n n n n Modify password tables Deface web pages Add viruses or Trojan horses to files Modify routing tables, DNS, … Modify audit logs Tampering with network packets Protection n Hash codes, digital signatures, encryption

Repudiation n Attacker denies an action which is hard to verify n n Claim

Repudiation n Attacker denies an action which is hard to verify n n Claim didn’t delete file make purchase receive services Protection n Audit logs Require receipts Digital signatures

Information Disclosure n Attacker sees sensitive data n n n Attacker gets information about

Information Disclosure n Attacker sees sensitive data n n n Attacker gets information about system architecture n n Local files Network packets Banners that display software type and version Protection n n Strong authentication and access control Encrytion of sensitive data Turn off banners, disable tracing and debugging Use terse error messages

Denial of Service n Syn flooding n n n Distributed Denial of Service Amplification

Denial of Service n Syn flooding n n n Distributed Denial of Service Amplification attacks n n Send partial connection requests to overflow server’s list of pending connections Send icmp echo requests to broadcast address, spoofing victim’s address Protection n Install server patches Block incoming icmp requests Throttle anonymous requests

Elevation of Priviledge n Gain administrator priviledge n Buffer overflow attack § Overflow designed

Elevation of Priviledge n Gain administrator priviledge n Buffer overflow attack § Overflow designed to overwrite return address of function with address of malicous code. n n Exploit bugs in operating system Protection n Avoid buffer overflows Validate user input Use principle of Least Priviledge § Grant smallest set of priviledges needed to function n Patch operating system

Social Engineering Threat n Social Engineering and Manipulation n n Trick someone into disclosing

Social Engineering Threat n Social Engineering and Manipulation n n Trick someone into disclosing information, e. g. , passwords, credit card ids, SSNs, … Manipulation Threats n Phreaking § Use fee-based services without payment n Phishing § Acquire sensitive information by luring attacks, usually by email. n Pharming § Redirecting DNS routes to unauthorized sites to get sensitive information. § Your on-line banking redirected to Afganistan, for example. n False representation § Pretend to be service technician, manager, account owner, … n Inside Job § Employee conspires with attacker to compromise system or information.

Security Models n PDR n Protection § topic of this presentation n Detection §

Security Models n PDR n Protection § topic of this presentation n Detection § detect attacks n Response § plan responses for each threat category • • Call the sys. Admin Call the police Contact the FBI Contact Federal Trade Commission

Security Models n AAS -. Net Web Model n Authentication § Accept and validate

Security Models n AAS -. Net Web Model n Authentication § Accept and validate credentials presented by user n Authorization § If validated, determine right to access some resource n Secure communication § Secure the channel • SSL, IPsec § Secure the data • signing, hashing, cryptography

Security Models n Windows and. Net n Role-based § Authenticate and authorize users, groups,

Security Models n Windows and. Net n Role-based § Authenticate and authorize users, groups, and accounts (System, Local service, Network service) § Actions are authorized through permissions n Evidence-based or Code Access Security (CAS) § Code is elevated to the security status of a user. § Authorization is based on evidence • url, zone, publisher, strong name, custom assembly attributes § Actions are authorized through policies

Win Security Definitions n Definitions for people and groups of people n SID –

Win Security Definitions n Definitions for people and groups of people n SID – Security IDentifier § Data structure used to identify user or group. n Access Token § A data structure that holds a SID for a security principal, the SIDs for each group the principal belongs to, and a list of the principal’s priviledges on the local computer. n Principal § An account holder that is assigned a SID for access to resources, e. g. , user, group, service, or computer.

Win Security Definitions n Definitions for objects n n Files, directories, kernel objects ACL

Win Security Definitions n Definitions for objects n n Files, directories, kernel objects ACL – Access Control List § Set of permissions for a specific object or a set of the object’s properties. § Discretionary (DACL) and System (SACL) are subgroups. n Security Descriptor § A data structure holding information about a protected object, e. g. , who can access, in what way, whether audited.

Win Security Definitions n Combinations of people and objects n Security Context § Set

Win Security Definitions n Combinations of people and objects n Security Context § Set of rules for a user’s actions on a protected object § Combination of user’s access token and object’s security descriptor n Security Policy § Rules that define the allowable contexts and mandatory groups.

Role-Based Security n n Use role-based security in programs to control access to methods

Role-Based Security n n Use role-based security in programs to control access to methods or properties at run-time. Host authenticates user and provides identity and role information to CLR. n n n Uses NTFS access control lists, IIS security settings. CLR makes that information available to code via APIs and permission demands. Can isolate security from code using attributes defined in System. Security or Enterprise. Services n n System. Security is limited to Windows user groups Enterprise. Services uses COM+ roles § Classes have to inherit from Enterprise. Services n Which to choose? n n If application has both managed and unmanaged use COM+. If application is entirely managed then System. Security is appropriate.

Code Access Security n Goals n End-user experience § Managed apps just run §

Code Access Security n Goals n End-user experience § Managed apps just run § Safe defaults, no run-time decisions needed n Administrator § § § All settings in one place and easy to customize Simple policy model Security administration tools • . Net configuration, CASPOL n Developer § Focus on application, security comes free § Easy to understand extend when needed

Mobil Code n Old Model n n n n Obtained from a network, often

Mobil Code n Old Model n n n n Obtained from a network, often via a web page. Without CAS have either full trust or no trust. User decides whether to run. If run, code has all the user’s priviledges. Inproc COM component, when loaded, becomes part of the process. Can’t distinguish between library code and original application code. CAS model n n n Operation based on evidence. Allowed actions can be defined at very detailed level. Each assembly can have its own security context.

Evidence-Based Security n Definitions n Permissions § Objects that represent specific authorized actions §

Evidence-Based Security n Definitions n Permissions § Objects that represent specific authorized actions § Permission grant is an authorization for an action given to an assembly § Permission demand is a security check for specific grants n Policy § Set of permissions granted to an assembly n Evidence § Inputs to policy about code n All three can be extended using security APIs.

Standard Permissions n Permissions for framework resources n n n Data, environment, file IO,

Standard Permissions n Permissions for framework resources n n n Data, environment, file IO, Message Queue, reflection, sockets Directory services, event log, web, performance counters, registry, UI DNS, file dialog, isolated storage, printing, security system

Standard Permissions n Identity permissions n n Publisher, site, string name, url, zone User

Standard Permissions n Identity permissions n n Publisher, site, string name, url, zone User identity permission n Only non-code access permission in Framework.

Code Access Security n n Is evidence-based Most permissions are code access n n

Code Access Security n n Is evidence-based Most permissions are code access n n Demanding permission performs a stack walk checking for grants of all callers Two ways to make checks § Imperative – call a method § Declarative • Attributes in code • Attributes in configuration file n Get security by § Calling class libraries in Framework § Calling application code with checks

How it works n n Loader extracts evidence from assembly Evidence is input to

How it works n n Loader extracts evidence from assembly Evidence is input to policy n Each level, Enterprise, Machine, User, and App. Domain, are evaluated § For each level the union of grants for each matching code group is determined § Intersection of permissions from each of these levels are granted to the assembly n n Apply any assembly permission requests Result is the permissions granted to the assembly.

Stack Walk Modifiers n Assertions n n If code vouches for its callers then

Stack Walk Modifiers n Assertions n n If code vouches for its callers then checks for permissions stop here. Gatekeeper classes n Managed wrappers for unmanaged resources § Demand permission to call unmanaged § Assert permission to call unmanaged § Make the call to unmanaged

Code Access Control n Identity permissions can apply to code as well as users

Code Access Control n Identity permissions can apply to code as well as users and groups n n n Based on evidence – signature, location, … Declarative checks made by JIT at compiletime. Imperative checks made by CLR at run-time.

Policy n Process of determining what permissions to grant to code. n n Policy

Policy n Process of determining what permissions to grant to code. n n Policy levels n n n Enterprise Machine User Application domain Each policy level is a collection of code groups n n Per-assembly basis All code, internet zone, intranet zone, site, strong name (MS Office), publisher Permission grants are intersection of policy levels and union of collection of code groups. n n Code gets only permissions common to Enterprise, Machine, user, App. Domain Gets all permissions of all groups to which it belongs.

Default Policies n Local Computer n n Intranet n n Safe UI, isolated storage,

Default Policies n Local Computer n n Intranet n n Safe UI, isolated storage, web access to same site Restricted n n Limited read environment, UI, isolated storage, assertion, web access to same site, file read to same UNC directory Internet n n Unrestricted No access, can’t execute Strong name (Framework classes) n Unrestricted

Framework Support n Classes used to represent evidence n n Zone, Url, Site, Application.

Framework Support n Classes used to represent evidence n n Zone, Url, Site, Application. Directory, Strong. Name, Publisher, Hash Classes used to represent permissions n DBData. Permission, Printing. Permission, Socket. Permission, File. IOPermission, Registry. Permission, …

. Net Configuration Tool

. Net Configuration Tool

Editing Permissions

Editing Permissions

All Standard Permissions Can configure applications as well as users and machines.

All Standard Permissions Can configure applications as well as users and machines.

Creating a User Code Group

Creating a User Code Group

Adding New Permissions

Adding New Permissions

Specific Permissions

Specific Permissions

The Result

The Result

Evidence n Evidence is input to policy n n Evidence is extensible n n

Evidence n Evidence is input to policy n n Evidence is extensible n n n Any object can become evidence Only affects permission grants if some code group condition uses it Hosts n n Strong name, publisher identity, location Machine, IIS, ASP. Net, SQL Server Fully trusted hosts specify implicitly trusted evidence. Semi-trusted hosts cannot provide evidence. Hosts can limit policy for App. Domains they create.

Elevating Trust

Elevating Trust

Elevating Trust n Why would you want to do that? n Deploy applications from

Elevating Trust n Why would you want to do that? n Deploy applications from server § Don’t have to install on many machines § Don’t have to update on many machines § Users always have the latest version n Need to elevate trust § If downloaded, CAS will prevent code from using any machine resources (files, environment, …). Can only communicate back to server. n Can be selective § Trust everything from server or only this particular application.

Requesting Permissions n Assemblies can request permissions n n Minimal, Optional, Refused If policy

Requesting Permissions n Assemblies can request permissions n n Minimal, Optional, Refused If policy does not grant everything in Minimal set, assembly will not load. Assembly is granted: Max. Allowed (Minimal Optional) – Refused Example: [assembly: UIPermission. Attribute (Security. Action. Request. Minimum, Window=UIPermission. Window. Safe. Sub. Windows) ] [assembly: Security. Permission. Attribute (Security. Action. Request. Refused, Unmanaged. Code=true) ]

Minimizing Security Flaws n Safe code n n Managed code verified for typesafety at

Minimizing Security Flaws n Safe code n n Managed code verified for typesafety at runtime. Eliminates: § § n n Buffer overrun attacks Reading private state or uninitialized memory Access to arbitrary memory in process Transfer execution to arbitrary location in process Developers can use Least Priviledge. Code access security blocks most luring attacks. n Stack walks prevent malicious code from using otherwise secure code obtained from naïve user.

Summary n Managed code has both Role-based and Evidence-based (CAS) security applied. n n

Summary n Managed code has both Role-based and Evidence-based (CAS) security applied. n n n Get a lot for free, simply by loggin in and running code that calls Framework Library. You can add security features to your code as well. CAS is. Net model for mobile code. Evidence is discovered by loader Policy turns evidence into permissions Permissions determine what your code can and cannot do.