+ All Categories
Home > Documents > Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for...

Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for...

Date post: 30-Jun-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
21
October 25, 2006 Security and Cryptography – What's up C12N ? Sébastien Pouliot [email protected]
Transcript
Page 1: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

October 25, 2006

Security and Cryptography – What's up C12N ?

Sébastien [email protected]

Page 2: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

2

Quick Overview

Secure Execution Environment • What ? Runtime, Code Access Security, Class libraries• When ? Mono 1.2, Mono 2.0 ...• Who ?

Crimson Project• Why and How ?

Tools• Gendarme• Monoxide

Page 3: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

3

Secure Execution EnvironmentRuntime, Code Access Security & Class libraries

Page 4: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

4

Mono 1.2

Goal• Implement a usable subset of Code Access Security (CAS)

– Runtime, JIT and class libraries

Results• SecurityManager and most related managed classes

– permissions, attributes, policies, membership conditions...

• Support for declarative security (i.e. attributes)– Demand, Assert, Deny, PermitOnly, LinkDemand, InheritanceDemand ...

• Stack Walks– with one or two appdomains (sandbox)

What's missing• Imperative security, most permissions in BCL, audit ...

Page 5: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

5

Mono 1.2 / Demo

NRobotAuthor: Stuart BallardHome page: http://home.gna.org/nrobot/License: GPL

Best open source .NET sandbox

Page 6: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

6

Mono 1.2 / Findings

Lack of applications requiring CAS• almost every of them are from Microsoft (IE, SQL Server 2005)• egg/chicken problem – at least for Mono

Very few applications/libraries are CAS aware• not really an egg/chicken problem – considering MS

implementation has been available for years

Lack of interest to contribute• maybe it's not sexy enough ;-)

just rememberIt's there but it's not ready for production use!

Page 7: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

7

Mono 2.0

New security features (Fx 2.0)• non CAS related

– SslStream, System.Security.Cryptography.Pkcs, ...

• CAS– New features– Much wider API to cover (permission, audit)

Complete missing features• from Fx 1.0/1.1

Help!• Want it ? Want more ? Yes you can help!• The “good thing” when there is so much to do is that there are

tasks for everyone ;-) No security knowledge is required!

Page 8: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

8

Crimson Project

Page 9: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

9

Crimson / Goals

Provide a new playground to:• Extend,• Simplify, and• Optimize

cryptography in the .NET framework.

Why ?• it's not part of .NET so it doesn't have to be inside Mono

– and it can be useful to everyone, everywhere (runtime agnostic)

• will be easier to change Crimson than Mono– e.g. stability requirements, export restrictions paperwork...

• different licenses may be required (but MIT.X11 is preferred)

Page 10: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

10

Crimson / Extend

by providing ...

• alternative implementations of existing cryptographic algorithms

– Existing native librairies, e.g. libmhash support is already in SVN– Optimized (e.g. unrolled) managed implementations

• new cryptographic algorithms unavailable in .NET– e.g. new hash algorithms, like TIGER (available in libmhash)

• new tools– e.g. benchmarking

Page 11: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

11

Crimson / Simplify

The existing .NET design for cryptography is• 80% nice, for new stuff• 20% bad, mostly because of CryptoAPI workarounds• but you need to know what you're doing, so many people ends

up reinventing the wheel.

Solution• Provide easier API mapping to user, not cryptographic, tasks

– e.g. 2.0 introduces ProtectedData and ProtectedMemory classes, but it doesn't reuse the design strengths

WARNING: don't let security people define the easy API ;-)

Page 12: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

12

Crimson / Optimize

sha1sum versus SHA1Managed versus libmhash SHA1

25,000 250,000 2,500,000 25,000,0000

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

0 0.01 0.03

0.36

0.04 0.07

0.23

1.92

0.06 0.06 0.08

0.36

SHA-1sha1summanaged

native

Page 13: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

13

[Recent] Tools

Page 14: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

14

Tools

The partial work done on securing the class libraries has shown the need for tools to assist in auditing Mono code base.

This resulted in two different tools:• Gendarme and• Monoxide

Page 15: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

15

Gendarme

Built on top of Cecil, Gendarme is split into 3 main components:

• Runner(s)– User interface to run rules on selected assemblies;– Currently only a console-based runner exists and output directly to the

console, XML or HTML files;•

• Framework– Shared logic to ease writing rules (helpers) and writing runners (avoid code

duplication);•

• Rules– Anything you want / and that you don't want to audit again;– For me it mostly means, find potential security issues and promote Gendarme

rule development (e.g. UseStringEmptyRule).

Page 16: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

16

Gendarme / Demo

btw Gendarme could use a logo...

Page 17: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

17

Gendarme / Future

• More rules!

• More polish– add inclusion/exclusion of rules – add ignore (notabug) lists– I18N– more documentation ...

• GUI runners like– a standalone GTK# runner– a standalone SWF runner (for Windows users); and– a MonoDevelop add-in (e.g. similar to the NUnit add-in)

Page 18: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

18

Monoxide

Same goal as Gendarme - find defects in compiled assembly, but with a different strategy!

Extensible assembly viewer with plug-ins for:• Assembly dependencies graphs• Callers analysis• IL viewer : source and graphs• Declarative security source

Yes, it's currently very security oriented.

Page 19: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

19

Monoxide / Demo

Warning

Carefully review any license agreements before using Monoxide on assemblies that you have not written yourself.

In many cases using Monoxide could be interpreted as some kind of reverse engineering.

Page 20: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

20

Monoxide / Future

User interface improvements• add zoom +,-,fit... to graphical views• better treeview (icons like MD)• add colors (e.g. icall, unsafe)• add printing support

More plug-ins• detect unsafe code (e.g. ldflda, pointers)• add monop-style support on class (C#)• Inheritance graphs (dot);• UML plug-in (non-dot);

Semi-automation (i.e. virtual tours)

Page 21: Security and Cryptography – What's up C12N · 11 Crimson / Simplify The existing .NET design for cryptography is • 80% nice, for new stuff • 20% bad, mostly because of CryptoAPI

21

Questions ?or (better) Answers ?


Recommended