+ All Categories
Home > Documents > Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant /...

Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant /...

Date post: 24-May-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
51
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation http://www.owasp.org Sécurité des Web Services (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter meeting Lieu: Genève (Suisse) 6 décembre 2012 05/06.11.2012, Version 1.1 @smaret
Transcript
Page 1: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

The OWASP Foundation http://www.owasp.org

Sécurité des Web Services (SOAP vs REST)

Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter meeting Lieu: Genève (Suisse) 6 décembre 2012

05/06.11.2012, Version 1.1 @smaret

Page 2: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

2

Page 3: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Bio

• 18 years of experience in ICT Security

• Principal Consultant at MARET Consulting

• Expert & Lecturer at University of Applied Sciences (Yverdon)

• Swiss French Area delegate at OpenID Switzerland

• Co-founder Application Security Forum #ASFWS

• OWASP Member

• Author of the blog: la Citadelle Electronique

• http://ch.linkedin.com/in/smaret or @smaret

• http://www.slideshare.net/smaret

• Chosen field – AppSec / Digital Identity Security / Cyber Defense

3

Page 4: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

4

Page 5: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Web Service ?

5

XML, JSON, etc. Consumer Provider

Page 6: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Un peu d’histoire

• 1990 : DCE/RPC – Distributed Computing Environment

• 1992 : CORBA – Common Object Request Broker Architecture

• 1990-1993 : Microsoft’s DCOM -- Distributed Component Object Model

• 1995: RMI – Monde Java

• Pour arriver à une standardisation (toujours en cours) des protocoles, outils, langages et interfaces

– SOAP

– REST

– Etc.

6

Web Service

Page 7: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Typical Web Services environment

7 Source: Mastering Web Services Security / www.wiley.com

Page 8: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

8

Page 9: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

SOAP: Démystification des technologies

• Langages

– XML

– WSDL : Descripteur du service

– UDDI: Annuaire des services

– Xpath

• Protocoles

– Transport: HTTP, HTTPS, SMTP, FTP, SMS, TFTP, SSH, etc. (TCP or UDP)

– Message: Enveloppe SOAP

• Sécurité

– WS-Security (Signature & Chiffrement)

• Autres éléments

– AuthN: SAML, X509, Username & Password, Kerberos, HTTP Digest, etc.

9

Page 10: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Enveloppe SOAP

10

- SOAP : Simple Object Access Protocol - Permet l’envoi de messages XML

Source= wikipédia

Page 11: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

11

SOAP request

SOAP response

Page 12: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

UDDI

• Universal Description Discovery and Integration, connu aussi sous l'acronyme UDDI, est un annuaire de services fondé sur XML et plus particulièrement destiné aux services Web.

12

Page 13: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

WSDL

• WSDL est une grammaire XML permettant de décrire un Service Web.

• Le WSDL sert à décrire : – le format de messages requis pour communiquer avec ce

service

– les méthodes que le client peut invoquer

– la localisation du service

– le protocole de communication (SOAP RPC ou SOAP orienté message)

13

http://fr.wikipedia.org/wiki/Web_Services_Description_Language

Page 15: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

WSDL: exemple

15

Page 16: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

SOAP: Démystification des protocoles

16

UDDI

WSDL

SOAP / XML

HTTP, HTTPS, FTP, SFTP, SMS, SMTP (TCP or UDP)

IP

Découverte

Description

Message

Protocole

Transport

Page 17: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

17

Page 18: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

REST: Démystification des technologies

• Langages

– XML

– JSON

– XHTML, HTML, PDF... as data formats

• Protocoles

– HTTP(s) Utilisation d’une URL

– Méthode de communication (GET, POST, PUT, DELETE)

• Sécurité

– Sécurité du transport (SSL/TLS)

– Sécurité des messages: HMAC / Doseta / JWS, etc. (Like XML Signature)

• Autres éléments

– Oauth, API Keys, etc.

18

Page 19: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Représentation REST (exemple JSON)

19

Page 20: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Méthodes REST

20

Page 21: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

REST: Démystification des protocoles

21

XML, JSON, etc.

HTTP, HTTPS

TCP/IP

Message

Protocole

Transport

WADL, Swagger *** Description

*** Avant-gardiste!

??? Découverte

Page 22: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Example

22

Page 23: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Example Twitter (OAuth)

23

Page 24: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

24

Page 25: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

SOAP vs REST

25

Page 26: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

26

Page 27: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

27 http://fr.wikipedia.org/wiki/Diagramme_de_flux_de_donn%C3%A9es

Page 28: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

28

Page 29: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Modèle STRIDE

29

https://www.owasp.org/index.php/Application_Threat_Modeling

Page 30: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Menaces - DFD Acme SA

• Threat 1 – Interception des messages (Information disclosure)

– Modification des messages (Tampering)

– Usurpation d’identité (Spoofing)

• Threat 2 – Attaque de l’application

• BoF

• Injection

• DoS & DDoS

• Etc

30

Page 31: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

31

Page 32: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

ACME SA: Réduction des risques ?

• Chiffrement du transport

• AuthN

• SSL Mutual AuthN / X509

• WAF / XML Gateway

• Intégrité et confidentialité des messages

• Secure Coding

32

Page 33: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Chiffrement du transport

33

SOAP / XML REST

HTTPS SSL/TLS tunnel SSH IPSEC Etc.

HTTPS

Page 34: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

AuthN

34

SOAP / XML REST

HTTP Basic, Digest, HTTP Header Mutual SSL IP trust WS Security user name password WS SAML Authentication token XML Signature Kerberos Etc.

HTTP Basic, Digest, HTTP Header Mutual SSL IP trust Oauth API Keys JSON Web Token (JWT)

Page 35: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

SSL Mutual AuthN / X509 / PKI

35

SOAP / XML REST

SSL/TLS Mutual AuthN** SSL/TLS Mutual AuthN**

** Man in the middle not possible… (As I Know)

Page 36: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

WAF / XML Gateway (Protection périmétrique)

36

SOAP / XML REST

Reverse Proxy Contrôle requêtes HTTP Rupture SSL/TLS Black List White List Validation WSDL Signature & Verification Encryption & Decryption SAML

Reverse Proxy Contrôle requêtes HTTP Rupture SSL/TLS Black List White List

Page 38: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Example XML Signature (SOAP)

38

Page 39: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Example JSON “Signature”

39

Page 40: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Code security

40

SOAP / XML REST

- Data input validation - Data output encoding - Pseudorandom data generation, high entropy - Strong / reliable data encryption algorithms - Data leakage prevention - Robust error & exception handling - Anti-automation and expiration measures

- Data input validation - Data output encoding - Pseudorandom data generation, high entropy - Strong / reliable data encryption algorithms - Data leakage prevention - Robust error & exception handling - Anti-automation and expiration measures

OWASP Application Security Verification Standard (ASVS): https://www.owasp.org/index.php/ASVS WASC web application weaknesses: http://projects.webappsec.org/w/page/13246978/Threat%20Classification

Page 41: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Agenda

• Qu’est-ce qu’un Web Service ?

• SOAP

• REST

• Threat Modeling / ACME SA

• Réduction des risques

• Conclusion

• Questions

41

Page 42: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Conclusion

• SOAP: – Implémenter les standards WS-* liés à la sécurité?

– Mettre en place un filtrage applicatif (WAF, XML GW)

– Complexe à mettre en œuvre (PKI, Secure coding, Cryptography, etc.)

– Architecture à forte contrainte de sécurité

• REST – Mettre en place un filtrage applicatif (WAF, XML GW)

– Implémentation rapide et facile tendance

– Architecture de type Cloud, Intranet, Social Login, etc.

– Emergence des standards (JSON Web Algorithms)

• On attend avec impatience les standards sécu pour REST ???

– Pragmatique: protection périmétrique, chiffrement et Secure Coding ???

42

Page 43: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Approche périmétrique vs WS-Security ?

43

Page 44: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Questions?

44

Page 45: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Merci / Thank you!

Contact:

[email protected]

@smaret

http://www.maret-consulting.ch

Slides: http://slideshare.net/ASF-WS/

45

Page 46: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

The OWASP Foundation http://www.owasp.org

46

Backup Slides

By Sylvain Maret

Page 47: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

47

Page 48: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

SoapBox

48

Page 49: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Capture HTTP

49

Page 50: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Signer le message

50

Page 51: Sécurité des Web Services · 2020-05-18 · (SOAP vs REST) Sylvain Maret Principal Consultant / MARET Consulting / @smaret OpenID Switzerland OWASP Switzerland - Geneva Chapter

Signer le message

51


Recommended