11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7: Building Secure Assemblies 147Unauthorized Access or Privilege Elevation, or bothThe risk with unauthorized access, which can lead to privilege elevation, is that anunauthorized user or unauthorized code can call your assembly <strong>and</strong> executeprivileged operations <strong>and</strong> access restricted resources.VulnerabilitiesVulnerabilities that can lead to unauthorized access <strong>and</strong> privileged elevation include:● Weak or missing role-based authorization● Internal types <strong>and</strong> type members are inadvertently exposed● Insecure use of code access security assertions <strong>and</strong> link dem<strong>and</strong>s●Non-sealed <strong>and</strong> unrestricted base classes, which allow any code to derivefrom themAttacksCommon attacks include:● A luring attack where malicious code accesses your assembly through a trustedintermediary assembly to bypass authorization mechanisms● An attack where malicious code bypasses access controls by directly calling classesthat do not form part of the assembly’s public APICountermeasuresCountermeasures that you can use to prevent unauthorized access <strong>and</strong> privilegeelevation include:● Use role-based authorization to provide access controls on all public classes <strong>and</strong>class members.● Restrict type <strong>and</strong> member visibility to limit which code is publicly accessible.●●S<strong>and</strong>box privileged code <strong>and</strong> ensure that calling code is authorized with theappropriate permission dem<strong>and</strong>s.Seal non-base classes or restrict inheritance with code access security.Code InjectionWith code injection, an attacker executes arbitrary code using your assembly’sprocess level security context. The risk is increased if your assembly calls unmanagedcode <strong>and</strong> if your assembly runs under a privileged account.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!