Misusing Open Services on the Internet Jelte Fennema Ben de Graaff - - PowerPoint PPT Presentation

misusing open services on the internet
SMART_READER_LITE
LIVE PREVIEW

Misusing Open Services on the Internet Jelte Fennema Ben de Graaff - - PowerPoint PPT Presentation

Misusing Open Services on the Internet Jelte Fennema Ben de Graaff University of Amsterdam Supervisor: Rick van Galen (KPMG) February 3, 2016 Introduction Approach Proof of concept Results Scanning the Internet Conclusion References


slide-1
SLIDE 1

Misusing Open Services on the Internet

Jelte Fennema Ben de Graaff

University of Amsterdam

Supervisor: Rick van Galen (KPMG) February 3, 2016

slide-2
SLIDE 2

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Introduction

Open service: no authentication or default credentials Relevant: more than 35,000 open MongoDB instances Exposing 685 TB (last December [1]) More than just data leaks – example: botnet command and control

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 2/24

slide-3
SLIDE 3

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

A problem for devops and software developers

“Memcached does not spend much, if any, effort in ensuring its defensibility from random Internet

  • connections. So you must not expose Memcached directly

to the Internet.” – Memcached documentation “Everybody has privileges to do anything. Neat.” — CouchDB security documentation

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 3/24

slide-4
SLIDE 4

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Research goals

◮ What are settings that lead to exploitable services? ◮ What are the operations required when exploiting an open

service as a command & control server?

◮ What are best practices for default configurations and

authentication?

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 4/24

slide-5
SLIDE 5

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Approach

For various software packages...

◮ Examine configuration (weaknesses?) ◮ Tool to scan level of access ◮ Proof of concept: botnet command & control

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 5/24

slide-6
SLIDE 6

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Approach

For various software packages...

◮ Examine configuration (weaknesses?) ◮ Tool to scan level of access ◮ Proof of concept: botnet command & control

Scanning the Internet

◮ Shodan ◮ ZMap and our own scan tool

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 5/24

slide-7
SLIDE 7

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Software classes

◮ Relational databases: MySQL, MariaDB, PostgreSQL

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 6/24

slide-8
SLIDE 8

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Software classes

◮ Relational databases: MySQL, MariaDB, PostgreSQL ◮ NoSQL databases: MongoDB, CouchDB

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 6/24

slide-9
SLIDE 9

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Software classes

◮ Relational databases: MySQL, MariaDB, PostgreSQL ◮ NoSQL databases: MongoDB, CouchDB ◮ Key-value store: Redis, Memcached

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 6/24

slide-10
SLIDE 10

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Software classes

◮ Relational databases: MySQL, MariaDB, PostgreSQL ◮ NoSQL databases: MongoDB, CouchDB ◮ Key-value store: Redis, Memcached ◮ Message queue: RabbitMQ

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 6/24

slide-11
SLIDE 11

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Software classes

◮ Relational databases: MySQL, MariaDB, PostgreSQL ◮ NoSQL databases: MongoDB, CouchDB ◮ Key-value store: Redis, Memcached ◮ Message queue: RabbitMQ ◮ Printing protocols: CUPS (and IPP printers)

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 6/24

slide-12
SLIDE 12

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Proof of concept

Simple botnet simulation (communication channel):

◮ Botnet operator sends signed commands to one bot or all bots ◮ Bots execute commands, write back encrypted results

Setup Write command Read command Write result Read result Operator Operator Bot

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 7/24

slide-13
SLIDE 13

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Impact on the Internet

What is the impact on the Internet? Is configuration security a factor?

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 8/24

slide-14
SLIDE 14

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-15
SLIDE 15

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N Authentication by default Y Y Y Y N N N N No public creds or anon Y Y Y Y N N N N

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-16
SLIDE 16

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N Authentication by default Y Y Y Y N N N N No public creds or anon Y Y Y Y N N N N Host-based access control Y Y Y Y N N N N

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-17
SLIDE 17

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N Authentication by default Y Y Y Y N N N N No public creds or anon Y Y Y Y N N N N Host-based access control Y Y Y Y N N N N Authentication always on N Y N Y N N N N

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-18
SLIDE 18

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N Authentication by default Y Y Y Y N N N N No public creds or anon Y Y Y Y N N N N Host-based access control Y Y Y Y N N N N Authentication always on N Y N Y N N N N Minimal steps to make open 3 2 3 1 1 1

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-19
SLIDE 19

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Configuration security

PostgreSQL MySQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached Localhost (in config) Y Y Y N Y Y N N Not public (default) Y N Y N Y N N N Authentication by default Y Y Y Y N N N N No public creds or anon Y Y Y Y N N N N Host-based access control Y Y Y Y N N N N Authentication always on N Y N Y N N N N Minimal steps to make open 3 2 3 1 1 1 Steps to make public/secure 3 2 3 1 3 3 1 2

Table 1: Comparison of security settings for the software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 9/24

slide-20
SLIDE 20

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Percentage of open services exposed to the Internet

PostgreSQL CUPS RabbitMQ CouchDB MongoDB Redis Memcached IPP

Software packages

0% 20% 40% 60% 80% 100%

Percentage of open services

Open with limited access Open

Figure 1: Percentages of open services.

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 10/24

slide-21
SLIDE 21

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Combined results

P

  • s

t g r e S Q L C U P S R a b b i t M Q C

  • u

c h D B M

  • n

g

  • D

B R e d i s M e m c a c h e d I P P Localhost (in config) Y Y N Y Y N N – Not public (default) Y Y N Y N N N – Authentication by default Y Y Y N N N N – No public creds or anon Y Y Y N N N N – Host-based access control Y Y Y N N N N – Authentication always on N N Y N N N N – Minimal steps to make open 3 3 1 1 1 – Steps to make public/secure 3 3 1 3 3 1 2 – Percentage open 2% 21% 22% 72% 71% 37% 98% 81% With full access 2% 1% 22% 18% 71% 37% 98% –

Table 2: Combined comparison of software packages

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 11/24

slide-22
SLIDE 22

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

First attempt: Shodan

Shodan:

◮ Scans the Internet ◮ Sends command related to that service ◮ Stores result in plain text

Full text search interface to find open services Example: port:5984 couchdb !unauthorized

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 12/24

slide-23
SLIDE 23

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Shodan results

Package Open Closed Memcached 100,044 – MongoDB 47,351 – Redis 13,455 23,174 RabbitMQ 6,487 23,121 PostgreSQL 6,391 293,481

Table 3: Worldwide statistics based on Shodan

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 13/24

slide-24
SLIDE 24

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Shodan inconclusive results

Package Unknown Closed MySQL/MariaDB 1,767,930 2,231,132 Non-CUPS IPP 23,948 1,664 CouchDB 2,783 513 CUPS 5,591 29,387

Table 4: Inconclusive statistics based on Shodan

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 14/24

slide-25
SLIDE 25

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Shodan unknowns

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 15/24

slide-26
SLIDE 26

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Second attempt: Our own scan

Shodan incomplete for some services Setup

◮ Permission to scan all Dutch IPs ◮ Not allowed to log in to any service

(required for MySQL, PostgreSQL)

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 16/24

slide-27
SLIDE 27

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Second attempt: Our own scan

Shodan incomplete for some services Setup

◮ Permission to scan all Dutch IPs ◮ Not allowed to log in to any service

(required for MySQL, PostgreSQL) How

◮ ZMap to port scan (5.5 minutes for 4.6 million IPs) ◮ ~20,000 hits per port ◮ Scanner modified for concurrency (7 minutes at 500

concurrent requests)

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 16/24

slide-28
SLIDE 28

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Our scan results

Service Open Closed Admin Memcached 98% 3,725 70 – IPP 81% 260 61 – CouchDB 72% 190 73 47 MongoDB 71% 1,859 753 – CUPS 21% 474 1,824 13

Table 5: Dutch statistics based on our scan

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 17/24

slide-29
SLIDE 29

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Type of IP range per service

CUPS/IPP

◮ Consumer networks ◮ Some universities ◮ Businesses

Memcached, MongoDB, CouchDB

◮ Mostly hosting services

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 18/24

slide-30
SLIDE 30

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Other quirks we found

CUPS: Print jobs can contain arbitrary attributes . . . turning a printing job into a key-value store

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 19/24

slide-31
SLIDE 31

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Other quirks we found

CouchDB: Default security policy empty (writable by anyone) . . . including database containing user credentials

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 20/24

slide-32
SLIDE 32

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Other quirks we found

Memcached: Authentication requires different, binary protocol . . . not even supported by all clients

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 21/24

slide-33
SLIDE 33

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Conclusion

◮ Open services still an issue ◮ Exploitation is incredibly easy:

any service you can write data to and read it back later

◮ Bad (default) configuration can lead to exploitable services

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 22/24

slide-34
SLIDE 34

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Best practices

◮ Prefer localhost access, require authentication for remote

access

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 23/24

slide-35
SLIDE 35

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Best practices

◮ Prefer localhost access, require authentication for remote

access

◮ Secure defaults!

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 23/24

slide-36
SLIDE 36

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Best practices

◮ Prefer localhost access, require authentication for remote

access

◮ Secure defaults! ◮ Clear documentation and warnings (also in configuration)

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 23/24

slide-37
SLIDE 37

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

Best practices

◮ Prefer localhost access, require authentication for remote

access

◮ Secure defaults! ◮ Clear documentation and warnings (also in configuration) ◮ Simplify configuration of authentication (good configs, tools)

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 23/24

slide-38
SLIDE 38

Introduction Approach Proof of concept Results Scanning the Internet Conclusion References

References

John Matherly. It’s Still the Data, Stupid! 15th Dec. 2015. url: https://blog.shodan.io/its-still-the-data-stupid/ (visited on 27/01/2016). Shodan: the world’s first search engine for Internet-connected

  • devices. 2009. url: https://www.shodan.io/ (visited on

04/01/2016). Zakir Durumeric, Eric Wustrow and J. Alex Halderman. “ZMap: Fast Internet-Wide Scanning and its Security Applications”. In: Proceedings of the 22nd USENIX Security

  • Symposium. Aug. 2013.

Jelte Fennema, Ben de Graaff

Misusing Open Services on the Internet 24/24