DEV240 Fundamentals of Code Access Security Sebastian Lange Program Manager Common Language Runtime Microsoft Corporation.

Slides:



Advertisements
Similar presentations
Security for Developers Code Access Security Steven Borg & Richard Hundhausen Accentient, Inc.
Advertisements

Towards Remote Policy Enforcement for Runtime Protection of Mobile Code Using Trusted Computing Xinwen Zhang Francesco Parisi-Presicce Ravi Sandhu
Ahead of Time Dynamic Translation PreJit/NGEN by any other name George Bosworth Microsoft MRE04 March 21, 2004.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 16 Secure Coding in Java and.NET Part 1: Fundamentals.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 17 Secure Coding in Java and.NET Part 2: Code Access Control.
Enabling Secure Internet Access with ISA Server
.NET Framework Application Security Overview
DEV340.NET Framework Security Best Practices Sebastian Lange Program Manager Common Language Runtime Microsoft Corporation.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Introduction to Evidence-based security in.NET Framework Brad Merrill Program Manager.NET Frameworks Integration.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Security in.NET Jørgen Thyme Microsoft Denmark. Topics & non-topics  Cryptography  App domains  Impersonation / delegation  Authentication  Authorization.
Code Access Security vs. Role-Based Security  RBS  Security identity attached to user accounts  Access to resources specified according to user’s group.
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
Understanding Active Directory
Understanding Security Lesson 6. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding the System.Security Namespace Understand the.
.NET Code security including 4.0 & Tools Jon C. Arce
Delivering Excellence in Software Engineering ® EPAM Systems. All rights reserved. ASP.NET Authentication.
Working with Applications Lesson 7. Objectives Administer Internet Explorer Secure Internet Explorer Configure Application Compatibility Configure Application.
OFC302 Building Smart Document Solutions in Word & Excel Martin Sawicki Lead Program Manager.
A First Program Using C#
DEV334 Creating Application Starting Points & Sharing Best Practices with Enterprise Templates Marc Gusmano Director of Emerging Technologies The Information.
Introduction to .Net Framework
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
Understanding Code Compilation and Deployment Lesson 4.
DEV290 Building Office Solutions with Visual Studio Eric Carter Lead Developer Developer Platform & Evangelism Microsoft Corporation.
ASSEMBLY. A SSEMBLY Assemblies are the fundamental units of applications in the.net framework An assembly can contain classes, structures, interfaces.
ASSEMBLIES AND THE GAC CHAPTER 1, LESSONS 4-7 & LAB.
WEB 304 An Overview of ASP.NET and Windows Workflow Foundation Kashif Alam Program Manager Developer Division Microsoft Corporation.
Java Security Pingping Ma Nov 2 nd, Overview Platform Security Cryptography Authentication and Access Control Public Key Infrastructure (PKI)
.NET Framework Danish Sami UG Lead.NetFoundry
Announcements Assignment 3 due. Invite friends, co-workers to your presentations. Course evaluations on Friday.
.Net Security and performance
SECURITY ISSUES. Introduction The.NET Framework includes a comprehensive set of security tools –Low-level classes and an overall framework –Managing code.
Code Access Security CS 795. Terminology--CLR Common Language Runtime: –The.NET Framework provides a runtime environment which runs the code and provides.
Slide 1 ASP Authentication There are basically three authentication modes Windows Passport Forms There are others through WCF You choose an authentication.
Section 11: Implementing Software Restriction Policies and AppLocker What Is a Software Restriction Policy? Creating a Software Restriction Policy Using.
System.Security.Policy namespace Chinmay Lokesh.NET Security CS 795 Summer 2010.
Presented By: Ahmed ALSUM PhD Student CS 895:.Net Security Old Dominion University College of Science Department of Computer Science.
Troubleshooting Security Issues Lesson 6. Skills Matrix Technology SkillObjective Domain SkillDomain # Monitoring and Troubleshooting with Event Viewer.
Windows Role-Based Access Control Longhorn Update
.NET Security and MSIL Tom Roeder CS fa. MSIL Common intermediate language really CIL in ECMA standard MSIL is common name Very close to C# (and.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
System.Security.Permissions namespace By Venkata Krishna Date: Instructor 06/19/2007 Dr. Ravi Mukkamala.
DEV396 Windows Forms: No Touch Deployment Tips and Tricks Jamie Cool Program Manager.NET Client Microsoft Corporation.
DEV395 No Touch Deployment for Windows Forms Jamie Cool Program Manager.NET Client Microsoft Corporation.
Microsoft Visual Studio 2005 Tools for the Office System: Building Office Solutions Using Visual Studio 2005 Tools for Office Andrew Coates Developer Evangelist.
Understanding Security
Active Directory. Computers in organizations Computers are linked together for communication and sharing of resources There is always a need to administer.
DEVC02.NET Framework Security Best Practices Sebastian Lange Program Manager Common Language Runtime Microsoft Corporation.
System.Security.policy Namespace By: Marepalli Gayathri.
Understanding.NET Framework Security David LeBlanc Microsoft Office.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Customizing.NET Security Permissions Nageswari Vallabhaneni.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Chapter 7. Permissions Programming.Net Security, O’Reilly Publishers.
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
ClickOnce Deployment (One-click Deployment)
.NET Security and MSIL Tom Roeder CS fa.
Jim Fawcett CSE775 – Distributed Objects Spring 2005
Building Secure Client Applications In Windows "Longhorn"
Visual Studio Tools for Office 2005
Security mechanisms and vulnerabilities in .NET
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
Security & .NET 12/1/2018.
1/14/ :03 PM Session Code: arc340
Chapter 8: Security Policy
Jim Fawcett CSE681 – SW Modeling & Analysis Fall 2018
ClickOnce Deployment (One-click Deployment)
Presentation transcript:

DEV240 Fundamentals of Code Access Security Sebastian Lange Program Manager Common Language Runtime Microsoft Corporation

Agenda Code Access Security (CAS) Design Goals Relationship to Windows OS Security CAS Infrastructure Verification and Validation Evidence Policy Permissions Enforcement

What is a Security System? Main Purpose: to protect a resource from illicit access or use Primary security identity System grants rights, enforces against specific identities Authentication Determining who is trying to gain access Authorization Granting rights to access resources Enforcement System Enforces the rights given

Example: Windows Security Primary Security Identity: User identity (or user role) Authentication: User supplies login credentials Authorization: User context is granted rights to access system objects Enforcement: OS gates access to system objects (File, Registry Key, …). Think ACL’s.

Code Access Security – A New Paradigm Primary Security Identity: Code (Assembly) Authentication: Information collected about code (Evidence) Authorization: Code identity based policy system grants rights to access resources Enforcement: Verification, Validation, Permission Demands, Stackwalks

Code Access Security Design Goals Robust security system for partially- trusted, mobile code Adds on to user-level security from OS Security out of the box Default Policy is conservative Required for end users and some Admins All code from Internet, Intranet, File Shares, … runs with restricted privileges

Code Access Security Design Goals Make it easier for… Developers to write secure libraries and applications As much burden as possible on the system Easy to perform security checks in code Administrators to express their policies Fine-grained authorization model System is completely extensible End users to work securely Minimal run-time security decisions (end-user UI by default)

CAS Infrastructure Validation Ensures correctness of file format Verification Ensures Type Safety Policy System Assigns trust to an assembly Enforcement Shared Library authors protect access to resources CLR enforces protection through stackwalks

Validation Checks Correctness of the PE file Validates image against PE spec Meta Data is checked MD layout validation: i.e pointers have valid destinations Semantic checks: i.e. Checking for circular inheritance IL stream is checked All instructions are valid and well-formed Semantic checks: i.e JMP’s stay within IL stream

Verification Enforces rules on code Ensures that Security can be enforced Verification rules are safe, may falsely reject Code is verified to be memory type safe Only access objects via well-defined interfaces No unsafe casts, no access beyond array bounds No stack underflow/overflow conditions Helps reduce buffer overruns

Verification Occurs during JIT Compilation Verifiability depends on the language compiler Visual Basic®.NET C# verifiable (except C# “unsafe” keyword) C++ is generally not verifiable Addressed in future release

Evidence Descriptive data about an assembly URL of origin, site, zone Strong Name signature, Authenticode signature, hash Host-defined Basis for assigning security rules Computed at load time of assembly by CLR Hosts can add their own evidence See System.Security.Policy.Evidence

CAS Policy Set of rules that assign trust to an assembly Specified by Administrator using.NET Configuration Tool Input: Data describing an assembly (Evidence) location, digital signature, hash, “host-defined” Output: Set of rights to access protected resources (Permissions) e.g File Permission, Registry Permission

CAS Policy Composed of “Code Groups” Membership Condition Permission Set Organized into a Hierarchy Multiple, Ordered Policy Levels Enterprise, Machine and User Final Output: Intersection of permissions granted by each level Result: Most restrictive wins Stored as XML files on disk See System.Security.Policy

CAS Policy System PolicyEvaluator Assembly A2 SecurityPolicy Evidence G2 Host GrantedPermissions

Default CAS Policy demo demo

Permissions Permissions represent the right to interact with a given resource Permission to access a resource demanded programmatically Output of Security Policy Implemented as Managed Classes See System.Security.Permissions, System.Security.CodeAccessPermission

Example Permissions FileIO Registry FileDialog Environment IsolatedStorage UI Printing Reflection Security Socket Web DNS OleDb SQLClient MessageQueue EventLog DirectoryServices … extensible Execute, Skip Verification, Call unmanaged code, Supply custom evidence

Permission Enforcement Permission “Demands” Statement made in code to protect access to a resource Checks all callers for the required permission May be “Imperative” or “Declarative” Declarative Specified via Custom Attributes before a Class, Method, etc … Imperative Initiated by Calling Demand() on a Permission instance Checks Enforced through Stack Walk Failed Demands raise a SecurityException

Declarative Demands Specified using Custom Attributes Stored in the assembly’s metadata Permission State must be known at compile time Can be viewed with PermView SDK Tool [FileIOPermission(SecurityAction.Demand, Write = "c:\\temp")] public void foo() { // class does something with c:\temp }

Declarative Demands Link and Inheritance Demands Checks only immediate caller for required permission Used to seal access to a method or restrict derivation Link Demand: “My caller must be signed with Key xxx” Inheritance Demand: “ You may only subclass me if you’re signed with Key yyy” Checks only the first call to a protected member Occurs during JIT Compilation Performs better than a full Demand

Imperative Demands Allows Security Checks to Vary by Control Flow or Method State Initiated with call to Demand() Example: A File Constructor public File(String fileName) { //Fully qualify the path for the security check String fullPath = Directory.GetFullPathInternal(fileName); new FileIOPermission(FileIOPermissionAccess.Read, fullPath).Demand(); //The above call will either pass or throw a //SecurityException //[…rest of function…] }

Putting it all Together PolicyEvaluator Assembly A3 SecurityPolicy Evidence G3 Host GrantedPermissions Assembly A1 Assembly A2 Assembly A3 G2 G1 G3 Call Stack

Stack-walking Semantics Method M3 Method M2 Method M1 Method M4 Call Stack Grows Down G2 G1 G3 G4 Each method has a set of corresponding grants Method M4 demands a permission P P P is compared with grants of all callers on the stack above M4 P P P

Stack Walk Modifiers Modifiers allow fine-grained control of the stack walk Assert, Deny, PermitOnly Most common modifier is Assert “I vouch for my callers; checks for this permission can stop with me” Use with Caution!! Example: “Gatekeeper” classes Managed wrappers for unmanaged resources Demand appropriate permission from caller Assert permission to call unmanaged code Make the unmanaged call

Key Takeaways CAS is based on code identity Augments Windows Security Model Administrators Set Security Policy Evidence Granted Permissions.Net Configuration Tool Code Authors Demand Permissions Protects access to resources CLR uses the call stack to enforce policy

Additional Resources “.NET Framework Security”, Addison- Wesley MSDN Security Site DEV340 “.Net Framework Security Best Practices”

Community Resources MS Community Sites List of newsgroups microsoft.public.dotnet.general microsoft.public.dotnet.framework microsoft.public.dotnet.clr microsoft.public.dotnet.security ListServs ADVANCED-DOTNET DOTNET-CLR DOTNET-ROTOR Attend a free chat or webcast Locate a local user groups Community sites

evaluations evaluations

© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.