Как предотвратить несанкционированный доступ к устройству cisco через консольный порт
Switch(config)# line console 0
Switch(config-line)# password cisco
Switch(config-line)# login
Switch(config)# line vty 0 15
Switch(config-line)# password cisco
Switch(config-line)# login
Безопасная Cisco
Remote control & credentials
- 0 уровень: enable password Qwerty!23 – хранение данных в открытом виде.
- 4 уровень: enable secret Qwerty!23 – преобразование данных в SHA256 Encryption в IOS 15, т.к. «change to new encryption, md5 can be deprecated soon».
- 5 уровень: enable secret Qwerty!23 – преобразование данных в MD5 Hash.
L2 Security
- Vlans бывают: Primary и Secondary: Isolated или Community.
- Vlans types: Isolated (может быть только в единственном экземпляре, связь внутри vlan отсутствует, только с Promiscuous), Community (много, связь внутри Vlan есть и с Promiscuous)
- Ports Types: Promiscuous — Primary Vlan port что-то типа dg, также Isolated и Community
- Private Vlans требуют включения VTP transparent: vtp mode transparent.
CAM protection
Если взять утилиту macof (есть в Kali) и запустить ее на генерирование MAC адресов с клиента подключенного к коммутатору, то в зависимости от модели коммутатора через некоторое время он станет хабом. Почему? Из-за того, что место в CAM таблице закончится. Для того чтобы это предотвратить существует режим port security на интересующем нас интерфейсе: и
Работает этот режим только на trunk или access port, но не на dynamic port.
У режима имеются параметры: Protect (no packets if violation, no log), Restrict (no packets if violation, log: snmp, sylog), Shut down port (default, max=1, log: snmp, sylog), Shut down Vlan. Есть режимы Dynamic (memorize 5 first mac), Static (manually write into running config static mac) и еще sticky (brand new network -> auto write in running config).
Да и в конце настройки нужно не забыть активировать сам режим.
Snooping table
Для того, чтобы обезопасить себя от атак на dhcp можно применять dhcp snooping table. Суть заключается в том, что коммутатор запоминает за каким портом у него легальный dhcp сервер, тем самым выполнить dhcp starvation attack (ну или кто-то просто принес из дома dlink) с портов доступа не получится.
Включается режим отдельно на всю железку и vlans:
Ограничить количество запросов dhcp можно командой ip dhcp snooping limit rate 20. И по необходимости посмотреть имеющиеся связи:
Изначально в этом режиме по умолчанию все порты являются не доверенными.
DAI
На основе snooping table работает DAI – dynamic arp inspection, т.е. динамически сравнивает MAC-IP и тем самым предотвращает ARP poisoning: ip arp inspection vlan 456.
Это тип атаки при которой рассылаются ARP пакеты с измененными MAC адресами, после обновления ARP таблицы проводится MITM.
Если же в инфраструктуре нет DHCP, то аналогичного функционала можно добиться с использованием arp access-list:
IP Spoofing/Source Guard
Опять же на основе snooping table функционирует IP Spoofing/Source Guard.
Яркий пример атаки с подменой IP, когда злоумышленник генерирует различные пакеты с разными IP DESTINATION и одинаковым IP SOURCE. В итоге все Destination пытаются ответить Source и проводят его DDoS.
Этот набор команд поможет защититься от атак типа IP Spoofing.
STP
Как вы знаете основной задачей STP является устранение петель в топологии, в которой есть избыточные соединения. Но возможно реализовать такую схему, когда нарушитель станет root bridge и опять же реализует MITM:
Для того, чтобы активировать защиту глобально на всех портах необходимо использовать команду spanning-tree portfast bpduguard default.
Далее переводим порт в режим portfast и получаем… Вместо тысячи слов:
Отдельно на интерфейсе это делается командой: spanning-tree bpduguard enable.
Как предотвратить несанкционированный доступ к устройству cisco через консольный порт
понедельник, декабря 24, 2012
Обеспечению безопасности устройств Cisco Systems
7 коммент.:
Зравствуйте, а как Вы считаете пароль "gjkgbpls" считается надежным или нет?
Конечно Виталий, но лучше все же будет 123=)
интересно было прочитать
Рад что вам было интересно=)
Пароли зашифрованные алгоритмом Cisco 7 поддаются расшифровке, в отличие от хеша, в данном случае MD5. Можете сами попробовать на password-decrypt.com (не реклама=)). Над паролем gjkgbpls на русской раскладке поржал. Спасибо за статьи.
Да что же это такое, уже второй раз с комментарием не попадаю! Опять следующая статья об этом =)
Ничего страшного, самое главное что вы читаете статьи! Причем судя по тому, что вы находите неточности, читаете вы их действительно внимательно и вдумчиво!
Безопасная Cisco
Всем привет!
Многие из вас видели и читали прекрасные материалы под общим названием «Сети для самых маленьких». Собственно, я не претендую на лавры, но решил написать нечто подобное в области безопасности сети на основе оборудования Cisco.
Первый материал будет посвящен BaseLine/L2 Security, т.е. тем механизмам, которые можно использовать при начальной конфигурации устройств а также на L2 коммутаторах под управлением IOS.
Всем, кому интересно, поехали!
Допустим, у нас brand-new [switch/router], для первой главы не принципиально. Мы подключаемся к нему с помощью консольного провода (более подробно описано Часть.1 Сети для самых маленьких). Т.к. мы не хотим, чтобы железка лежала у нас на столе или (если она уже в стойке) стоять и мерзнуть в серверной, сразу настроим на ней удаленное управление.
Remote control & credentials
- 0 уровень: enable password Qwerty!23 – хранение данных в открытом виде.
- 4 уровень: enable secret Qwerty!23 – преобразование данных в SHA256 Encryption в IOS 15, т.к. «change to new encryption, md5 can be deprecated soon».
- 5 уровень: enable secret Qwerty!23 – преобразование данных в MD5 Hash.
Вроде бы все, если что забыл, прошу отписаться в комментарии, по крайней мере JDima, всегда делал стоящие комментарии.
L2 Security
- Vlans бывают: Primary и Secondary: Isolated или Community.
- Vlans types: Isolated (может быть только в единственном экземпляре, связь внутри vlan отсутствует, только с Promiscuous), Community (много, связь внутри Vlan есть и с Promiscuous)
- Ports Types: Promiscuous — Primary Vlan port что-то типа dg, также Isolated и Community
- Private Vlans требуют включения VTP transparent: vtp mode transparent.
Применять или нет решать вам в зависимости от целей.
Вроде бы все ясно, однако если Promiscuous port маршрутизируем, то существует возможность попасть из ISOLATED в другие VLAN, путем посылки подкрафченного пакета до L3 устройства. Закрывается такая возможность с помощью ACL на маршрутизаторе.
Примерно схожий функционал c Isolated VLAN имеется при настройке PVLAN Edge или Protected port. Настраивается это на каждом интерфейсе отдельно командой: switchport protected.
Ну и в завершении с VLAN рассмотрим ACL для VLANs: VLAN ACL (VACL) или VLAN map а также MacSec.
Если возникает необходимость контролировать трафик внутри VLAN нужно определить трафик и повесить его на нужный VLAN, примерно вот так:
Создаем обычный список доступа, который будет использоваться в VACL. Определим VLAN access map. Определим действие при совпадении трафика со списком. Применим к VLAN. 1 класс трафика будет останавливаться, весь другой пересылаться.
Интересная функция в IOS — MacSec.
Вот такой набор команд (к примеру на 2 устройствах):
Настроив на L2 устройствах, на портах через которые два коммутатора соединены между собой, получим симметрично зашифрованный канал (pmk на устройствах должен быть одинаковым).
CAM protection
Если взять утилиту macof (есть в Kali) и запустить ее на генерирование MAC адресов с клиента подключенного к коммутатору, то в зависимости от модели коммутатора через некоторое время он станет хабом. Почему? Из-за того, что место в CAM таблице закончится. Для того чтобы это предотвратить существует режим port security на интересующем нас интерфейсе:
и
Работает этот режим только на trunk или access port, но не на dynamic port.
У режима имеются параметры: Protect (no packets if violation, no log), Restrict (no packets if violation, log: snmp, sylog), Shut down port (default, max=1, log: snmp, sylog), Shut down Vlan. Есть режимы Dynamic (memorize 5 first mac), Static (manually write into running config static mac) и еще sticky (brand new network -> auto write in running config).
Да и в конце настройки нужно не забыть активировать сам режим.
Snooping table
Для того, чтобы обезопасить себя от атак на dhcp можно применять dhcp snooping table. Суть заключается в том, что коммутатор запоминает за каким портом у него легальный dhcp сервер, тем самым выполнить dhcp starvation attack (ну или кто-то просто принес из дома dlink) с портов доступа не получится.
Включается режим отдельно на всю железку и vlans:
Ограничить количество запросов dhcp можно командой ip dhcp snooping limit rate 20. И по необходимости посмотреть имеющиеся связи:
Изначально в этом режиме по умолчанию все порты являются не доверенными.
DAI
На основе snooping table работает DAI – dynamic arp inspection, т.е. динамически сравнивает MAC-IP и тем самым предотвращает ARP poisoning: ip arp inspection vlan 456.
Это тип атаки при которой рассылаются ARP пакеты с измененными MAC адресами, после обновления ARP таблицы проводится MITM.
Если же в инфраструктуре нет DHCP, то аналогичного функционала можно добиться с использованием arp access-list:
Также есть функционал для сравнения ARP Validation Checks.
IP Spoofing/Source Guard
Опять же на основе snooping table функционирует IP Spoofing/Source Guard.
Яркий пример атаки с подменой IP, когда злоумышленник генерирует различные пакеты с разными IP DESTINATION и одинаковым IP SOURCE. В итоге все Destination пытаются ответить Source и проводят его DDoS.
Этот набор команд поможет защититься от атак типа IP Spoofing.
STP
Как вы знаете основной задачей STP является устранение петель в топологии, в которой есть избыточные соединения. Но возможно реализовать такую схему, когда нарушитель станет root bridge и опять же реализует MITM:
Для того, чтобы активировать защиту глобально на всех портах необходимо использовать команду spanning-tree portfast bpduguard default.
Далее переводим порт в режим portfast и получаем… Вместо тысячи слов:
Отдельно на интерфейсе это делается командой: spanning-tree bpduguard enable.
Storm Control
- Производится мониторинг: Broadcast/Multicast/Unicast
- Устанавливаются пороговые значения: %/PPS/BPS
- Выбирается действие: Slow/Shutdown
В дополнение к вышеописанному существуют такие технологии как: Root Guard, EtherChannel Guard, Loop Guard, Port Blocking.
За сим все, спасибо, что дочитали до конца. Надеюсь, информация окажется полезной.
Security Configuration Guide, Cisco IOS XE Everest 16.5.1a (Catalyst 3650 Switches)
The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
Book Title
Security Configuration Guide, Cisco IOS XE Everest 16.5.1a (Catalyst 3650 Switches)
Preventing Unauthorized Access
View with Adobe Reader on a variety of devices
Results
Chapter: Preventing Unauthorized Access
Preventing Unauthorized Access
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest caveats and feature information, see Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table at the end of this module.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
Restrictions for Controlling Switch Access with Passwords and Privileges
The following are the restrictions for controlling switch access with passwords and privileges:
Disabling password recovery will not work if you have set the switch to boot up manually by using the boot manual global configuration command. This command produces the boot loader prompt (switch:) after the switch is power cycled.
Information About Passwords and Privilege Levels
Default Password and Privilege Level Configuration
A simple way of providing terminal access control in your network is to use passwords and assign privilege levels. Password protection restricts access to a network or network device. Privilege levels define what commands users can enter after they have logged into a network device.
This table shows the default password and privilege level configuration.
Enable password and privilege level
No password is defined. The default is level 15 (privileged EXEC level). The password is not encrypted in the configuration file.
Enable secret password and privilege level
No password is defined. The default is level 15 (privileged EXEC level). The password is encrypted before it is written to the configuration file.
No password is defined.
Additional Password Security
To provide an additional layer of security, particularly for passwords that cross the network or that are stored on a Trivial File Transfer Protocol (TFTP) server, you can use either the enable password or enable secret global configuration commands. Both commands accomplish the same thing; that is, you can establish an encrypted password that users must enter to access privileged EXEC mode (the default) or any privilege level you specify.
We recommend that you use the enable secret command because it uses an improved encryption algorithm.
If you configure the enable secret command, it takes precedence over the enable password command; the two commands cannot be in effect simultaneously.
If you enable password encryption, it applies to all passwords including username passwords, authentication key passwords, the privileged command password, and console and virtual terminal line passwords.
Password Recovery
By default, any end user with physical access to the switch can recover from a lost password by interrupting the boot process while the switch is powering on and then by entering a new password.
The password-recovery disable feature protects access to the switch password by disabling part of this functionality. When this feature is enabled, the end user can interrupt the boot process only by agreeing to set the system back to the default configuration. With password recovery disabled, you can still interrupt the boot process and change the password, but the configuration file (config.text) and the VLAN database file (vlan.dat) are deleted.
If you disable password recovery, we recommend that you keep a backup copy of the configuration file on a secure server in case the end user interrupts the boot process and sets the system back to default values. Do not keep a backup copy of the configuration file on the switch. If the switch is operating in VTP transparent mode, we recommend that you also keep a backup copy of the VLAN database file on a secure server. When the switch is returned to the default system configuration, you can download the saved files to the switch by using the Xmodem protocol.
To re-enable password recovery, use the service password-recovery global configuration command.
Terminal Line Telnet Configuration
When you power-up your switch for the first time, an automatic setup program runs to assign IP information and to create a default configuration for continued use. The setup program also prompts you to configure your switch for Telnet access through a password. If you did not configure this password during the setup program, you can configure it when you set a Telnet password for a terminal line.
Username and Password Pairs
You can configure username and password pairs, which are locally stored on the switch. These pairs are assigned to lines or ports and authenticate each user before that user can access the switch. If you have defined privilege levels, you can also assign a specific privilege level (with associated rights and privileges) to each username and password pair.
Privilege Levels
Cisco devices use privilege levels to provide password security for different levels of switch operation. By default, the Cisco IOS software operates in two modes (privilege levels) of password security: user EXEC (Level 1) and privileged EXEC (Level 15). You can configure up to 16 hierarchical levels of commands for each mode. By configuring multiple passwords, you can allow different sets of users to have access to specified commands.
Privilege Levels on Lines
Users can override the privilege level you set using the privilege level line configuration command by logging in to the line and enabling a different privilege level. They can lower the privilege level by using the disable command. If users know the password to a higher privilege level, they can use that password to enable the higher privilege level. You might specify a high level or privilege level for your console line to restrict line usage.
For example, if you want many users to have access to the clear line command, you can assign it level 2 security and distribute the level 2 password fairly widely. But if you want more restricted access to the configure command, you can assign it level 3 security and distribute that password to a more restricted group of users.
Command Privilege Levels
When you set a command to a privilege level, all commands whose syntax is a subset of that command are also set to that level. For example, if you set the show ip traffic command to level 15, the show commands and show ip commands are automatically set to privilege level 15 unless you set them individually to different levels.
How to Control Switch Access with Passwords and Privilege Levels
Setting or Changing a Static Enable Password
The enable password controls access to the privileged EXEC mode. Follow these steps to set or change a static enable password: