Cracking

Wednesday 3 October 2018, 13:14  #1
Cracking ELF MIPS - Basic Crackme
Aloras
  • 2 posts

Hi

I used qemu to build a mips based debian9

I have problems executing the application

root@debian: # ./ch27.bin
 bash: ./ch27.bin: cannot execute binary file: Exec format error

file recognizes the application as an elf

root@debian: # file ch27.bin
ch27.bin: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped

My CPU info

root@debian: # cat /proc/cpuinfo
system type : MIPS Malta
machine : mti,malta
processor : 0
cpu model : MIPS 24Kc V0.0 FPU V0.0
BogoMIPS : 1795.07
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

From my understanding this binary should be compatible

Is there a problem with the file or with my OS

Wednesday 3 October 2018, 23:13  #2
Cracking ELF MIPS - Basic Crackme
sanluri
  • 6 posts

I think it can help You,

ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2’s complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x400610
Start of program headers: 52 (bytes into file)
Start of section headers: 4028 (bytes into file)
Flags: 0x70001007, noreorder, pic, cpic, o32, mips32r2
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 27

Saturday 6 October 2018, 15:38  #3
Cracking ELF MIPS - Basic Crackme
Aloras
  • 2 posts

thanks I switched to a mipsel cpu
I had a followup problem that the binary depends on uclibc
There is no package on debian only a source package
I am currently using openwrt which uses uclic as a standard library
Is there an alternative OS or do i need to cross compile uclibc ?

Sunday 7 October 2018, 08:28  #4
Cracking ELF MIPS - Basic Crackme
sanluri
  • 6 posts

Hi,
I use Ubuntu. I’ve installed uclibc-ng. By default, set the + x attribute for the ch27.bin file.
Now you can debug the file with gdb.

Wednesday 31 October 2018, 23:15  #5
Cracking ELF MIPS - Basic Crackme
Throne6g
  • 9 posts

Well, did you solve this problem? After i switched to mipsel cpu i have the following problem "No such file or directory", I see that the binary depends on the uclibc, but I’m not sure that at the moment the problem is exactly this, what was your error when you realized that the problem is in the uclibc?

Friday 5 July 2019, 22:23  #6
Cracking ELF MIPS - Basic Crackme
jpc0016
  • 10 posts

I followed the Taming a Wild Nanomite document to run QEMU and have the same problem. The challenge binary shows up in my emulated system but I can’t run it. chmod +x is set on the binary.

```
root@debian-mipsel: # ./ch27.bin
 bash: ./ch27.bin: No such file or directory
```

Like the OP, my system recognizes the file as ELF. I have more problems when installing additional tools in aptitude. It seems the package pages no longer exist when running the install. There is very little support online for emulation and loading uClibc. Help is appreciated.