Analyzing VxWorks Firmware: A Comprehensive Guide

Analyzing VxWorks Firmware: A Comprehensive Guide

1. Introduction

Analyzing VxWorks Firmware: A Comprehensive Guide

The VxWorks operating system is an embedded real-time operating system (RTOS) designed and developed by Wind River in the United States in 1983, and it is a key component of embedded development environments.

Analyzing VxWorks Firmware: A Comprehensive Guide

2. Firmware Analysis

Analyzing VxWorks Firmware: A Comprehensive Guide

The common method for firmware extraction is to use the binwalk tool for analysis and extraction.

2.1 Extraction

Binwalk analysis shows that the firmware contains binary data compressed with lzma.

Analyzing VxWorks Firmware: A Comprehensive Guide

2.2 Decompression

You can use the lzma command or the binwalk command to decompress.

  • lzma

Analyzing VxWorks Firmware: A Comprehensive Guide

  • binwalk

Analyzing VxWorks Firmware: A Comprehensive Guide

This file is the VxWorks firmware we need to analyze.

Analyzing VxWorks Firmware: A Comprehensive Guide

3. Firmware Load Address

Analyzing VxWorks Firmware: A Comprehensive Guide

First, it is necessary to find the VxWorks system firmware load address; otherwise, the system will not run. The load address will affect some subsequent absolute address references, such as function tables and string references.

3.1 Check Device Architecture

  • ARM

Analyzing VxWorks Firmware: A Comprehensive Guide

3.2 IDA Analysis

  • Select ARM/little

Analyzing VxWorks Firmware: A Comprehensive Guide

  • Base address is 0

Analyzing VxWorks Firmware: A Comprehensive Guide

VxWorks uses usrInit for stack initialization, which is the first function that runs after the VxWorks system boots.

Analyzing VxWorks Firmware: A Comprehensive Guide

LDR R0,=0x40205000
BIC R0,R0,#3
SUB RO,RO,#4
MOV SP,RO #Stack initialization assignment R0=$sp+0 

It can be seen that the loaded base address is 0x40205000

3.3 Using Symbol Table to Fix Function Names

Bzero is a function in VxWorks that is used to clear the data in the bss section during system startup. Therefore, we can use “grep -r bzero” to find the bzero function.

$ grep -r bzero

Analyzing VxWorks Firmware: A Comprehensive Guide

  • memset

Analyzing VxWorks Firmware: A Comprehensive Guide

3.3.1 Manual Location

Symbol Table

Analyzing VxWorks Firmware: A Comprehensive Guide

00 05 1B 29 00 00 34 E4

File size and symbol table size

8 bytes after is the symbol table

00 00 34 E4 => 13540 (decimal)

8 + 8 * 13540 = 108328 (symbol table offset) -> symbol table location

Analyzing VxWorks Firmware: A Comprehensive Guide

Function symbol offset

54 00 00 00 40 37 36 84

Type (function) 54

Symbol table offset 00 00 00 -> 0

Memory offset 40 37 36 84

Function name AES_CMAC

3.4 VxHunter Tool for Repairing

3.4.1 Automatic Function Name Repair

Analyzing VxWorks Firmware: A Comprehensive Guide

This tool automatically identifies function symbols.

Analyzing VxWorks Firmware: A Comprehensive Guide

Project address:

https://github.com/PAGalaxyLab/vxhunter.git
Analyzing VxWorks Firmware: A Comprehensive Guide

4. Conclusion

Analyzing VxWorks Firmware: A Comprehensive Guide

The analysis of VxWorks firmware mainly focuses on memory load addresses and symbol tables. Modifying the symbol table and determining the memory load address play a crucial role in subsequent vulnerability exploitation.

Analyzing VxWorks Firmware: A Comprehensive Guide

Leave a Comment