This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:3dprinting:flashforge_creator_3_pro_fan_fix [2025/04/29 23:36] – [Reverse engineering - I] admin | projects:3dprinting:flashforge_creator_3_pro_fan_fix [2025/05/02 22:57] (current) – [Examining the main application creator3-arm] admin | ||
---|---|---|---|
Line 56: | Line 56: | ||
===== System Software Details ===== | ===== System Software Details ===== | ||
- | The Flashforge linux based system is made with an old version of [[https:// | + | The Flashforge linux based system is made with an old version of [[https:// |
+ | <code bash> | ||
+ | Welcome to flashforge | ||
+ | buildroot login: root | ||
+ | Password: | ||
+ | Login incorrect | ||
+ | </ | ||
- | Instructions about how to get root access, can be found on the internet.((See for example:\\ [[https:// | + | With the correct password, we would get an opportunity to analyze the system. It would be easier though if we can access |
- | Please click on [[projects: | + | Either way, without a username and password we will not get access to the system. Details about getting a username and password can be found on the internet.((See for example:\\ [[https:// |
+ | Please click on [[projects: | ||
- | Once a terminal connection is made to the printer, serious reverse engineering can start. There are several great tools for reverse engineering. I highly recommend [[https:// | + | Once a terminal connection is made to the printer, |
==== Reverse engineering - I ==== | ==== Reverse engineering - I ==== | ||
Line 219: | Line 225: | ||
* [[https:// | * [[https:// | ||
- | When inspecting | + | When inspecting creator3-arm((Version 1.4.0)) |
<code bash> | <code bash> | ||
Line 228: | Line 234: | ||
</ | </ | ||
\\ | \\ | ||
- | The ELF program headers table describes to the loader how to bring the binary into memory space for execution. The table defines a series of segments, where each segment contains specific information for the kernel, like where and how to map ELF file's data into memory, whether the program needs a so-called runtime loader for bootstrapping which is done by the systems' | + | The ELF program headers table describes to the loader how to bring the binary into memory space for execution. The table defines a series of segments, where each segment contains specific information for the kernel, like where and how to map ELF file's data into memory, whether the program needs a so-called runtime loader for bootstrapping which is done by the systems' |
- | , how to interpret the main thread' | + | |
- | + | ||
- | | + | |
+ | Which outputs the following: | ||
<code bash> | <code bash> | ||
Elf file type is EXEC (Executable file) | Elf file type is EXEC (Executable file) | ||
Line 265: | Line 270: | ||
</ | </ | ||
+ | From the output we can see this creator3-arm has nine program headers, from which the following is probably noteworthy: | ||
+ | * PHDR program header, which contains the program header table and its concerning metadata. | ||
+ | * INTERP program header, which tells the kernel that the file depends on an external loader file (/ | ||
+ | * LOAD program headers, tell the kernel and the loader how to get the program' | ||
+ | * DYNAMIC program header, which is used by the loader to create links to their shared library dependencies. It is also used by the loader to fix relocations for program code and pointers, if the program resides at a different place in memory than it expects based on its virtual address. | ||
+ | * NOTE program header potentially contains vendor-specific metadata about the program itself, describing a table of key-value pairs where each entry has a string name mapped to a sequence of bytes that describe the entry. | ||
+ | * GNU_STACK program header defining memory regions where the stack is marked with a no-execute flag. With this flag code cannot be executed if it is on the stack. | ||
- | Then to get more information about the ELF sections, we use: | + | The section headers, in contrast |
readelf --section-headers creator3-arm | readelf --section-headers creator3-arm | ||
Line 273: | Line 285: | ||
\\ | \\ | ||
which outputs the following: | which outputs the following: | ||
- | |There are 29 section headers, starting at offset 0x332934: | + | <code bash> |
- | ^ Section Headers: | + | There are 29 section headers, starting at offset 0x332934: |
- | ^ [Nr] | + | Section Headers: |
- | | [ 0] | + | [Nr] Name Type Addr |
- | | [ 1] | + | [ 0] |
- | | ... | ... | ... | ... | ... | ... | .. | .. | . | . | . | | + | [ 1] .interp |
- | | [ 5] | + | [ 2] .note.ABI-tag |
- | | [ 6] | + | [ 3] .note.gnu.build-i NOTE 00010168 000168 000024 00 |
- | | ... | ... | ... | ... | ... | + | [ 4] .hash |
- | | [ 9] | + | [ 5] .dynsym |
- | | [10] | + | [ 6] .dynstr |
- | | ... | ... | ... | ... | ... | ... | .. | .. | . | . | . | | + | [ 7] .gnu.version |
- | | [13] | + | [ 8] .gnu.version_r |
- | | [14] | + | [ 9] .rel.dyn |
- | | [15] | + | [10] .rel.plt |
- | | ... | ... | ... | ... | + | |
- | | [24] | + | [12] .plt PROGBITS |
- | | [25] | + | [13] .text |
- | | ... | ... | ... | + | [14] .fini |
- | | [28] | + | [15] .rodata |
- | | Key to Flags:\\ W (write), A (alloc), X (execute) | + | |
+ | [17] .ARM.exidx ARM_EXIDX | ||
+ | [18] .eh_frame | ||
+ | [19] .init_array | ||
+ | [20] .fini_array | ||
+ | [21] .jcr PROGBITS | ||
+ | [22] .dynamic | ||
+ | [23] .got PROGBITS | ||
+ | [24] .data | ||
+ | [25] .bss | ||
+ | | ||
+ | [27] .ARM.attributes | ||
+ | [28] .shstrtab | ||
+ | Key to Flags: | ||
+ | | ||
+ | L (link order), O (extra OS processing required), G (group), T (TLS), | ||
+ | C (compressed), | ||
+ | y (purecode), p (processor specific) | ||
+ | </ | ||
For clarity some sections have been left out. Most of the time the following sections are interesting for reverse engineering: | For clarity some sections have been left out. Most of the time the following sections are interesting for reverse engineering: | ||
Line 316: | Line 346: | ||
+ | When looking at the program headers in the ELF file, we can see the following information: | ||
+ | |||
+ | < | ||
+ | Start of program headers: | ||
+ | Size of this header: | ||
+ | Size of program headers: | ||
+ | Number of program headers: | ||
+ | </ | ||
+ | |||
+ | Then, when looking at the all of the eight program headers, and verifying the permissions at the p-flags, only program header 3 ist executable and contains the actual program. | ||
+ | |||
+ | < | ||
+ | # program header 3 | ||
+ | 00000094: 0100 0000 0000 0000 0000 0100 0000 0100 ................ | ||
+ | 000000a4: 880a 3300 880a 3300 0500 0000 0000 0100 ..3...3......... | ||
+ | p_type: | ||
+ | p_offset: (4 bytes) 0x000000 ( 0) | ||
+ | p_vaddr: | ||
+ | p_paddr: | ||
+ | p_filesz: (4 bytes) 0x330a88 (3345032) | ||
+ | p_memsz: | ||
+ | p_flags: | ||
+ | p_align: | ||
+ | p_data: | ||
+ | </ | ||
+ | |||
+ | Interestingly this program header has a p_align of 65536 bytes, which means that at the end 1398 bytes should be available: | ||
+ | |||
+ | With a hex Editor one can observe that this area indeed is filled with 0x00: | ||
+ | From 0x330a88 to 0x330fff (3345032 - 3346431 = 1399 bytes) | ||
+ | With that it should be possible to inject Code from the M104 command (979 bytes) into this area and adapt for the M106 command. | ||
===== Flashprint Wireshark ===== | ===== Flashprint Wireshark ===== | ||
When clicking a button in Flashprint to start or stop a fan, a network command is sent to the printer, which can be captured with tcpdump and analyzed with wireshark. Interestingly, | When clicking a button in Flashprint to start or stop a fan, a network command is sent to the printer, which can be captured with tcpdump and analyzed with wireshark. Interestingly, |