So=ware Security using Language Engineering and mbeddr - - PowerPoint PPT Presentation

so ware security
SMART_READER_LITE
LIVE PREVIEW

So=ware Security using Language Engineering and mbeddr - - PowerPoint PPT Presentation

Towards improving So=ware Security using Language Engineering and mbeddr Markus Vlter, Zaur Molotnikov, Bernd Kolb voelter@acm.org www.voelter.de @markusvoelter


slide-1
SLIDE 1 Markus ¡Völter, ¡Zaur ¡Molotnikov, ¡Bernd ¡Kolb ¡ voelter@acm.org ¡ www.voelter.de ¡ @markusvoelter ¡

Towards ¡improving ¡

So=ware ¡Security ¡

using ¡

Language ¡Engineering ¡and ¡mbeddr ¡ ¡

slide-2
SLIDE 2

1 ¡

So=ware ¡ Security ¡

slide-3
SLIDE 3

So=ware ¡security ¡refers ¡to ¡the ¡ security ¡proper8es ¡of ¡a ¡so9-­‑ ¡ ware ¡system’s ¡implementa8on. ¡ ¡

  • G. ¡McGraw, ¡ ¡
So9ware ¡Security: ¡Building ¡Security ¡In. ¡ ¡ Addison-­‑Wesley, ¡2006. ¡

¡

slide-4
SLIDE 4

So=ware ¡security ¡

Techniques ¡ Process ¡ Programming ¡Language ¡ (and ¡the ¡wrong ¡use ¡of ¡it) ¡

C ¡

EducaJon ¡ Awareness ¡ Reviews ¡
slide-5
SLIDE 5

So=ware ¡security ¡

Techniques ¡ Process ¡ Programming ¡Language ¡

C ¡

slide-6
SLIDE 6

So=ware ¡security ¡

Techniques ¡ Process ¡ Programming ¡Language ¡

C ¡

Make ¡C ¡beMer ¡and ¡less ¡ dangerous ¡through ¡suitable ¡ language ¡extensions. ¡
slide-7
SLIDE 7

So=ware ¡security ¡

Techniques ¡ Process ¡

C ¡

Make ¡C ¡beMer ¡and ¡less ¡ dangerous ¡through ¡suitable ¡ language ¡extensions. ¡
slide-8
SLIDE 8

2 ¡

Language ¡ Engineering ¡

slide-9
SLIDE 9

3 ¡

Language ¡ Workbenches ¡

slide-10
SLIDE 10

4 ¡

JetBrains ¡ ¡ MPS ¡

slide-11
SLIDE 11

A ¡Language ¡Workbench ¡– ¡

a ¡tool ¡for ¡defining, ¡composing ¡ and ¡using ¡ecosystems ¡of ¡languages. ¡

slide-12
SLIDE 12

Open ¡Source ¡ Apache ¡2.0 ¡ hMp://jetbrains.com/mps ¡

slide-13
SLIDE 13

V ¡3.2 ¡ ¡ ¡ ¡ ¡ ¡is ¡current. ¡ V ¡3.3 ¡ ¡ ¡ ¡ ¡ ¡in ¡RC ¡– ¡Release ¡Q4 ¡2015. ¡

slide-14
SLIDE 14

[Language ¡Workbench] ¡

+ Refactorings, Find Usages, Syntax Coloring, Debugging, ...

Comprehensive ¡Support ¡for ¡ ¡ many ¡aspects ¡of ¡Language ¡DefiniJon. ¡

slide-15
SLIDE 15

[Comprehensive ¡IDE ¡Features] ¡

For ¡End ¡Users ¡and ¡Language ¡Developers ¡

slide-16
SLIDE 16 TradiJonal: ¡Parsing ¡ MPS: ¡ProjecJonal ¡EdiJng ¡

MPS ¡uses ¡a ¡ProjecJonal ¡Editor ¡

[ProjecJonal ¡EdiJng] ¡

A ¡ProjecJonal ¡Editor ¡modifies ¡the ¡AST ¡directly. ¡ No ¡grammars ¡or ¡parsers ¡are ¡involved. ¡
slide-17
SLIDE 17 Regular ¡Code/Text ¡ MathemaJcal ¡ Tables ¡ Graphical ¡

Advantage: ¡SyntacJc ¡Flexibility ¡

[ProjecJonal ¡EdiJng] ¡

slide-18
SLIDE 18 Regular ¡Code/Text ¡ MathemaJcal ¡ Tables ¡ Graphical ¡

Advantage: ¡SyntacJc ¡Flexibility ¡/ ¡MPS ¡

[ProjecJonal ¡EdiJng] ¡

slide-19
SLIDE 19 L2 ¡ L1 ¡ Separate ¡Files ¡ In ¡One ¡File ¡ Type ¡System ¡ TransformaJon ¡ Constraints ¡ ¡ Type ¡System ¡ TransformaJon ¡ Constraints ¡ Syntax ¡ IDE ¡ ¡

Advantage: ¡Language ¡ComposiJon ¡

[ProjecJonal ¡EdiJng] ¡

5+ ¡ ¡ ¡base ¡languages ¡ 50+ ¡extensions ¡to ¡C ¡ 10+ ¡extensions ¡to ¡requirements ¡lang. ¡
slide-20
SLIDE 20 No ¡change ¡to ¡definiJon ¡of ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡or ¡ ¡

Advantage: ¡Language ¡ComposiJon ¡

[ProjecJonal ¡EdiJng] ¡

L2 ¡ L1 ¡ in ¡order ¡to ¡use ¡them ¡together. ¡

LHost ¡ LEmb ¡

+ ¡

Embedding ¡

= ¡

LAdapt ¡ + ¡ LBase ¡ LExt ¡

+ ¡

Extension ¡

= ¡

LBase ¡ LExt1 ¡

+ ¡

Extension ¡ComposiJon ¡

= ¡

LExt2 ¡

+ ¡

slide-21
SLIDE 21

Study ¡Results ¡on ¡Editor ¡Usability ¡

[ProjecJonal ¡EdiJng] ¡

Strongly ¡... ¡Neutral ¡... ¡Strongly ¡ agree ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡disagree ¡ People ¡prefer ¡MPS ¡over ¡convenJonal ¡IDEs ¡ MPS ¡more ¡is ¡more ¡efficient ¡than ¡normal ¡IDEs ¡ MPS ¡more ¡is ¡more ¡producJve ¡than ¡normal ¡IDEs ¡ MPS ¡makes ¡it ¡easier ¡to ¡create ¡correct ¡programs ¡ MPS ¡enforces ¡a ¡structurally ¡correct ¡AST ¡ People ¡benefit ¡from ¡language ¡modularity ¡ People ¡benefit ¡from ¡the ¡flexible ¡notaJons ¡ People ¡benefit ¡from ¡advanced ¡navigaJon ¡support ¡ The ¡experience ¡with ¡learning ¡MPS ¡is ¡mixed. ¡ It ¡takes ¡some ¡Jme ¡to ¡get ¡used ¡to ¡MPS ¡
slide-22
SLIDE 22

Further ¡Reading ¡

ProjecJng ¡a ¡Modular ¡Future ¡ Three ¡different ¡case ¡studies ¡of ¡using ¡MPS ¡ hRp://voelter.de/data/pub/projec8ngModuleFuture.pdf ¡ mbeddr ¡-­‑-­‑ ¡InstanJaJng ¡a ¡Language ¡Workbench ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡in ¡the ¡Embedded ¡So=ware ¡Domain ¡ ¡ Detailed ¡Discussion ¡of ¡mbeddr ¡(using ¡MPS ¡for ¡embedded ¡s/w ¡engineering) ¡ hRp://voelter.de/data/pub/voelteretal-­‑mbeddr-­‑AUSE.pdf ¡ Towards ¡User-­‑Friendly ¡ProjecJonal ¡Editors ¡ Study ¡about ¡the ¡usability ¡of ¡projec8onal ¡editors ¡and ¡MPS‘ ¡„tricks“ ¡for ¡improving ¡it ¡ hRp://voelter.de/data/pub/projec8onalEdi8ng-­‑sle2014.pdf ¡ The ¡State ¡of ¡the ¡Art ¡in ¡Language ¡Workbenches ¡– ¡LWC ¡Conclusions ¡ Systema8c ¡Comparison ¡of ¡different ¡language ¡workbenches ¡and ¡their ¡features ¡ hRp://voelter.de/data/pub/LWC13.pdf ¡
slide-23
SLIDE 23
slide-24
SLIDE 24

5 ¡

mbeddr ¡

slide-25
SLIDE 25

Tools ¡ Language ¡ ¡ Engineering ¡ Embedded ¡ So=ware ¡

slide-26
SLIDE 26

An ¡extensible ¡set ¡of ¡integrated ¡languages ¡ for ¡embedded ¡so=ware ¡engineering. ¡ ¡

slide-27
SLIDE 27

Open ¡Source ¡@ ¡eclipse.org ¡ Eclipse ¡Public ¡License ¡1.0 ¡ hMp://mbeddr.com ¡

slide-28
SLIDE 28

developers ¡

7 ¡developers, ¡project ¡management ¡ 2 ¡developers, ¡verificaJon ¡support ¡ 1 ¡developer, ¡verificaJon ¡support ¡ 3 ¡developers, ¡C++ ¡ strategic ¡collaboraJon ¡with ¡
slide-29
SLIDE 29

Some ¡of ¡the ¡C ¡Extensions ¡

Units ¡ State ¡Machines ¡ Components ¡ ¡ Math ¡
slide-30
SLIDE 30

An ¡IDE ¡for ¡Requirements ¡

Requirements ¡ Rules ¡ Tracing ¡ VisualisaJons ¡
slide-31
SLIDE 31

Great ¡IDE ¡Support ¡

slide-32
SLIDE 32

An ¡IDE ¡for ¡DocumentaJon ¡

slide-33
SLIDE 33
slide-34
SLIDE 34

6 ¡

SoluJon: ¡ Technique ¡

slide-35
SLIDE 35

Code ¡Markup ¡and ¡Checking ¡ Robustness ¡ ¡ Security ¡ Layers ¡checking, ¡access ¡permissions ¡ „Units“ ¡for ¡saniJzed ¡or ¡encrypted ¡data ¡

slide-36
SLIDE 36

Straighqorward ¡Language ¡Extensions ¡ Apple ¡GotoFail ¡bug: ¡ More ¡robust ¡construct: ¡

slide-37
SLIDE 37

Straighqorward ¡Language ¡Extensions ¡ BeMer ¡than ¡macros: ¡

Amazon‘s ¡s2n ¡library ¡

Danger: ¡ Macros ¡have ¡no ¡protecJon ¡against ¡ wrong ¡use; ¡Poor ¡man‘s ¡LE. ¡Real ¡LE ¡ ¡ is ¡more ¡robust/safer. ¡

slide-38
SLIDE 38

AdapJng ¡SemanJcs ¡

When ¡leaving ¡the ¡funcJon, ¡k_clr ¡sJll ¡on ¡ the ¡stack ¡– ¡only ¡stack ¡pointer ¡moved. ¡ As ¡variables ¡leave ¡scope, ¡actually ¡wipe ¡ their ¡memory. ¡

BeMer: ¡

slide-39
SLIDE 39

ExploiJng ¡the ¡GeneraJon ¡Step ¡ Timing ¡Side ¡Channel ¡AMacks: ¡ ¡ ¡ ¡ ¡Insert ¡random ¡waits. ¡

Amazon‘s ¡s2n ¡library ¡ Naming ¡convenJons ¡not ¡checkable. ¡ ¡ ¡ ¡ ¡SemanJc ¡AnnotaJons ¡beMer. ¡ ¡

Then ¡insert ¡busy ¡wait ¡at ¡end ¡ enforce ¡constant ¡Jme. ¡

slide-40
SLIDE 40

AddiJonal ¡Constraints ¡ Detect ¡insecure ¡C ¡funcJons: ¡ ¡ ¡ ¡ ¡ ¡strcpy ¡and ¡the ¡like. ¡ Mark ¡veMed ¡secure ¡funcJons ¡as ¡ SECURE ¡API ¡and ¡only ¡use ¡those. ¡ ¡Check ¡this ¡with ¡tool. ¡

slide-41
SLIDE 41

VerificaJon ¡I ¡

Heartbleed ¡bug: ¡ The ¡above ¡code ¡is ¡invalid ¡in ¡C ¡

¡cannot ¡„dynamically“ ¡iniJalize ¡length. ¡

Bug: ¡sizeof(payload) ¡!= ¡payload_length ¡

slide-42
SLIDE 42

VerificaJon ¡II ¡

Find ¡Problem ¡via ¡formal ¡VerificaJon ¡

slide-43
SLIDE 43

VerificaJon ¡III ¡

Even ¡beMer: ¡

First-­‑class ¡message ¡concept ¡ ¡ that ¡handles ¡low ¡level ¡message ¡stuff. ¡
slide-44
SLIDE 44

7 ¡

SoluJon: ¡ Process ¡

slide-45
SLIDE 45

BeMer ¡AbstracJon, ¡BeMer ¡Review ¡

This ¡is ¡beMer ¡than ¡a ¡switch-­‑case: ¡

slide-46
SLIDE 46

BeMer ¡NotaJon, ¡BeMer ¡Review ¡

slide-47
SLIDE 47

Tracing ¡

Trace ¡from ¡every ¡program ¡element ¡to ¡requirements ¡ ¡ ¡ ¡(internal ¡or ¡external) ¡ ¡ Analyze ¡and ¡find ¡untraced ¡program ¡fragments. ¡ Different ¡kinds ¡of ¡traces ¡to ¡express ¡semanJcs. ¡
slide-48
SLIDE 48

Expressing ¡Security ¡Requirements ¡

Requirements ¡are ¡Prose, ¡plus ¡arbitrary ¡ formal ¡parts, ¡inline ¡in ¡the ¡document. ¡ Requirements ¡can ¡be ¡classified ¡as ¡secure. ¡

Different ¡review ¡policy, ¡cannot ¡be ¡changed ¡(see ¡next) ¡
slide-49
SLIDE 49

Code ¡Review ¡and ¡Security ¡Audits ¡

Track ¡review ¡state ¡in ¡the ¡code ¡ Assess ¡review ¡state ¡over ¡the ¡system: ¡

slide-50
SLIDE 50

Code ¡Review ¡and ¡Security ¡Audits ¡

Track ¡review ¡state ¡in ¡the ¡code ¡ Assess ¡review ¡state ¡over ¡the ¡system: ¡

„Code“ ¡includes ¡requirements! ¡ Use ¡crypto ¡to ¡sign ¡the ¡review. ¡ Branching-­‑safe, ¡because ¡in ¡the ¡code. ¡ Highlight ¡unreviewed ¡code. ¡ On ¡any ¡granularity. ¡ Can ¡be ¡exported ¡into ¡process-­‑related ¡tools. ¡
slide-51
SLIDE 51

8 ¡

Discussion ¡

slide-52
SLIDE 52

EvaluaJon ¡Looks ¡interes8ng, ¡real ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡evalua8on ¡is ¡s8ll ¡missing. ¡ Learning ¡Languages ¡have ¡to ¡be ¡learned. ¡ Developing ¡ ¡MPS ¡makes ¡this ¡very ¡simple. ¡ TrusJng ¡ ¡A ¡tool ¡qualifica8on ¡issue. ¡ Legacy ¡Code ¡Import ¡and ¡Refactor. ¡ Tool ¡Lock-­‑in ¡Yes. ¡ Other ¡Languages ¡ ¡Works ¡in ¡Principle. ¡

slide-53
SLIDE 53

s

  • u

r c e ¡

slide-54
SLIDE 54

[Read ¡& ¡Learn] ¡

slide-55
SLIDE 55

Thank you!

voelter@acm.org ¡ www.voelter.de ¡ @markusvoelter ¡