-
Website
http://www.matasano.com/log -
Original page
http://www.matasano.com/log/1047/toast-spells-tsaot-in-reverse/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Press Controls
3 comments · 2 points
-
ChrisMtso
12 comments · 1 points
-
Eric Monti
11 comments · 1 points
-
StatlerAndWaldorf
12 comments · 3 points
-
Dave G.
7 comments · 1 points
-
-
Popular Threads
I think the symbol addresses were changed to protect the innocent.
@Tolomea: I spent about half a day working on reversing the image file headers and writing tools for working with them so I could install my patched "toaster". Another half a day looking at the actual application binary and getting it from raw binary to full disassembly with symbol names.
@Taco Master: Great question! A new link for blackbag will be back up soon. We'll post it here for sure.
Eric, are you suggesting a 1.0 release?
http://igorsk.blogspot.com/2007/12/hacking-kind...
Kevin
I'd particularly love to hear more about the Sony Reader, if you've got anything to tell.
I wasn't "suggesting" quite that. That puny one line patch for deezee is my sole contribution to blackbag to date.
But... stay tuned. Something along these lines is in the works, kind-of. That's all I'll say for now.
Narrowed it down to two candidates, now trying to get my hands on them to see if their firmware matches your description....
Somebody stop me and have me do something meaningful instead, please! ;)
Also starting with VxWorks 5.5.1, all objects and images on all architectures are in ELF format. In earlier versions, there were some architectures that used ELF, but some used a.out. That said, you don't always end up with an ELF image in your toaster, because there's more than one way to embedded VxWorks in a given device, and exactly how it's done is up to the designer.
During development, a device will use a VxWorks bootrom to load the runtime image. The bootrom is usually written to flash and is the first code the CPU runs when it comes out of reset. The bootrom is really just a special instance of VxWorks that has only one job, which is to initialize the hardware and load a runtime image either from local storage (flash TFFS filesystem) or the network. (Ok that's actually two jobs, but whatever.) Being able to download a new image into the system is handy during development since it saves you from having to keep writing new images into flash all the time.
If you want, however, you can also create a VxWorks ROMable image, which allows you to do without the bootrom. Instead, your image is written directly to flash and is the only code the CPU runs. It can be configured as totally ROM resident (code and initialized data stays in flash/ROM/etc...) or it can be made relocatable, where the image is copied into RAM after basic initialization.
If you use a ROMable image, then there is no image format: the resulting ELF image is converted to a flat binary file (and the symbol table is discarded).
(It is also possible for a sufficiently clever toaster maker to create their own bootloader, since you can very easly create flat binary files from any VxWorks image.)
As for the symbol table, there are two cases where you will find one. One is if you have an unstripped ELF image. (For some reason, nobody seems to care about stripping the symbol tables from VxWorks binaries.) The other is if you have a VxWorks image that contains the shell component. Not every VxWorks image include a shell, since some embedded applications don't have any I/O devices, but if you do. However, if it is included, the shell interpreter in VxWorks is really nothing more than a function caller: when you type a command on the shell, the shell looks for a symbol name in the image that matches in the symbol table, translates the symbol name into an address, and then just calls it. This is very useful during development, since it means you can directly invoke functions from the shell to see if they work as expected. Anyway, in this case, the symbol table is not the ELF symbol table: it's a separate one that's embedded in the image at compile time. (I think this is so that the symbol parser will work even if the ELF symbol table has been stripped.)
Note that is is possible to build a VxWorks image that includes the shell component, but which does not include the embedded symbol table.
Lastly, sysInit usually is the entry point for an image. Though for a bootrom or ROMable image, the entry point is usually called romInit (which is the CPU reset entry vector).
It's hard to tell if the manufacturer of your toaster is using a regular VxWorks image or a ROMable one. I'm a little surprised the full VxWorks banner is present, because the banner component is usually only pulled in if your image include the shell. And I can't imagine why a toaster would need a shell.
-Bill
Wow, thanks for all the VxWorks info. I've been hunting for all I can dig up. This definitely helps clarify and solidify some of what I've been reading about.
As you have inferred, there were several signs of a shell component present in my binary. The VxWorks relationship between shell and symbol table is one of the reasons why I mentioned that finding VxWorks symbol tables might be more common than on other targets. I wasn't sure enough about this to assert that here till you mentioned it.
Anyway... for the rest of us mortals:
This FAQ helped me some:
http://www.xs4all.nl/~borkhuis/vxworks/vxfaq.html
I also found the VxWorks reference site from Colorado Space Grant Consortium pretty handy:
http://spacegrant.colorado.edu/~dixonc/vxworks/
tsec.c: In function ‘main’:
tsec.c:44: error: too few arguments to function ‘setpgid’
tsec.c:44: error: too many arguments to function ‘setpgrp’
make: *** [tsec.o] Error 1
So in tsec.c, you'll want to change line 44:
if(setpgrp(0, setpgid()) == -1) {
to:
if (setpgid(getpid(),0)) {
I just posted up a 0.9.1 version that fixes this and adds the deezee tweak:
http://www.matasano.com/log/1048/blackbag-091-n...