-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Cisco firmwares #7
Comments
Hi @rmspeers You can using binwalk to extract the firmware. In the _sx300_fw-14112.ros.extracted folder, you can find a file named '3FC'. Load file 3FC to Ghidra(or IDA/Radare) as arm binary with load address 0x0, find the first brunch code at 0x00000054, this should jump to usrInit function(in most case). Function usrInit(offset:0x00012128) will call another function to zero out the bss segment. You can decompile and find the function below. You can find bss start and end address using function parameter. Now we have bss start address, you can using "bss_start_address" - firmware size to get the firmware image loading address. it's Rebase the 3FC to 0x100000 and you can start with your research. I haven't find the symbols and symbol file in this image, VxHunter can't automatic analyze image without VxWorks symbols. If you want test the VxHunter you can find example firmware at here |
This script should extract the firmware files. # !/usr/bin/env python3
# coding=utf-8
import struct
output_path = "./output"
source_file_data = open("sx300_fw-14112.ros", 'rb').read()
file_count = struct.unpack("<I", source_file_data[0x20:0x24])[0]
print("Found {} files in firmware".format(file_count))
print("Star extract files")
for i in range(file_count):
file_name = source_file_data[0x50 + (i * 0x20):0x60 + (i * 0x20)]
file_name = file_name.replace(b'\x00', b'')
print("file_name: {}".format(file_name))
file_offset = struct.unpack("<I", source_file_data[0x60 + (i * 0x20):0x60 + 4 + (i * 0x20)])[0]
file_length = struct.unpack("<I", source_file_data[0x60 + 4 + (i * 0x20):0x60 + 8 + (i * 0x20)])[0]
print("file_offset: {:#010x}".format(file_offset))
print("file_length: {}".format(file_length))
output_file = open("{}/{:#08x}_{}".format(output_path, file_offset, file_name.decode('utf-8'), ), 'wb')
output_file.write(source_file_data[file_offset: file_offset + file_length])
|
I believe the files such as sx300_fw-14106.ros downloadable from Cisco (https://software.cisco.com/download/home/284576363/type/282463181/release/1.4.11.02) should be vxWorks but am not seeing any strings indicating that when opening, and vxhunter isn't having luck. Do you have any ideas, or have other ideas of where to obtain samples to test with?
The text was updated successfully, but these errors were encountered: