I am close to having root on my DVR device running busybox. I figured out one of the user login/passwords and am able to telnet in, but that's it. I have a drive that is attached which automatically mounts, which I can plug into my PC to add/subtract files. I made a copy of the bash and busybox binaries (including a few others), and gave them u+s
, hoping setuid root would give me some root privileges. Unfortunately that did not work. Running bash
(-rwsr-xr-x
), id
still shows up as just user. For some reason it doesn't seem to honor the setuid bit for bash or busybox (or a few others) to give me root privs.
So, I had an idea, which brings me to my question: maybe I could compile a small C program, such as:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "/tmp/rootscript.sh" );
return 0;
}
Which, maybe, would allow me to run a script as root. Unfortunately, after a few days of trying to compile various versions of gcc-mips
on various systems, I've not been able to do so. Which leads me to ask if someone who already has the tools built would mind compiling the above code for me. I realize it's an odd request, but I guess it's come to this.
Some potentially helpful info:
bash-3.00$ cat cpuinfo
system type : Viper
processor : 0
cpu model : MIPS 74Kc V4.12 FPU V0.0
BogoMIPS : 324.40
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0000, 0x0000, 0x0000]
ASEs implemented : mips16 dsp
shadow register sets : 2
core : 0
VCED exceptions : not available
VCEI exceptions : not available
and
file /tmp/bash
/tmp/bash: setuid ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.12, not stripped
Any thoughts or advice from anyone? Hopefully this counts enough as a "reverse engineering" post!