Forum: Mikrocontroller und Digitale Elektronik Firmware eines NS0045-NAS entpacken


von hda (Gast)


Lesenswert?

Ich besitze ein NS0045-NAS von LogiLink:

http://www.logilink.com/showproduct/NS0045.htm

Da Linux als OS auf dem NAS läuft, habe ich mir gedacht, man kann 
vielleicht die Firmware anpassen.

Link zur Firmware:

http://www.2direkt.de/i-sell2u/images/driver/NS0045.zip

Nach entpacken mit unzip und der Analyse mit file habe ich 
herausgefunden das die einzelnen Dateien tar-Archive sind.

unzip NS0045.zip
Archive:  NS0045.zip
  inflating: 4_NS0045_filesystem.2.1.13.bin
  inflating: NS0045_Anleitung_Installation_2.1.13.doc
  inflating: 1_NS0045.2.1.13.bin
  inflating: 2_NS0045_kernel.2.1.13.bin
  inflating: 3_NS0045_bootfs.2.1.13.bin

file  4_NS0045_filesystem.2.1.13.bin
4_NS0045_filesystem.2.1.13.bin: POSIX tar archive (GNU)

Also habe ich die Dateien entpackt, wobei mich besonders das Filesystem 
interessierte:

tar xvf 4_NS0045_filesystem.2.1.13.bin
filesystem.bin
filesystem.bin.md5sum

Ein weiteres file auf filesystem.bin brachte keine weiteren nützlichen 
Infos:

file filesystem.bin
filesystem.bin: data

Allerdings liefern hexdump und binwalk einige Infos:
vergrößern

hexdump -C filesystem.bin | head
00000000  73 68 73 71 2f 01 00 00  00 00 00 a0 7b 8f b7 00 
|shsq/.......{...|
00000010  00 00 00 00 00 00 00 01  00 00 00 4c 03 00 01 00 
|...........L....|
00000020  eb 8d 14 00 d1 01 00 b0  05 7f 4d d3 03 02 20 00 
|..........M... .|
00000030  00 00 00 00 00 10 00 00  00 00 00 02 00 f0 bf 92 
|................|
00000040  d3 49 00 00 00 00 00 8e  d3 49 00 00 00 00 00 00 
|.I.......I......|
00000050  00 00 00 00 00 00 00 f9  9c 49 00 00 00 00 00 ec 
|.........I......|
00000060  c0 49 00 00 00 00 00 08  d1 49 00 00 00 00 00 86 
|.I.......I......|
00000070  d3 49 00 00 00 00 00 5d  00 00 10 00 68 19 00 00 
|.I.....]....h...|
00000080  00 00 00 00 00 3f 91 45  84 68 3b de de a6 0f 23 
|.....?.E.h;....#|
00000090  f0 d4 24 19 9b 6f 11 79  09 d1 7d bd 7c 5c bc b9 
|..$..o.y..}.|\..|

vergrößern

binwalk filesystem.bin | head

DECIMAL     HEX         DESCRIPTION
------------------------------------------------------------------------ 
-------------------------------
0           0x0         Squashfs filesystem, little endian, non-standard 
signature,  version 3.1, size: 4838290 bytes, 303 inodes, blocksize: 
1048576 bytes, created: Tue Mar 15 07:22:40 2011
119         0x77        LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 6504 bytes
2717        0xA9D       LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 41372 bytes
19292       0x4B5C      LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 30948 bytes
32633       0x7F79      LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 18580 bytes
41072       0xA070      LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 101456 bytes
82355       0x141B3     LZMA compressed data, properties: 0x5D, 
dictionary size: 1048576 bytes, uncompressed size: 519236 bytes

Demnach sollte es sich dabei um ein Squash-Filesystem handeln, aber 
unsquashfs streikt:

unsquashfs filesystem.bin
Can't find a SQUASHFS superblock on filesystem.bin

Hat einer von euch eine Idee wie ich unsquashfs zur Mitarbeit überreden 
kann oder hat vielleicht einer von euch selbst dieses NAS und weis wie 
ich telnet oder ssh aktivieren kann ? Droppbear ist zumindest laut dem 
Sourcecode dabei:

http://www.2direct.de/i-sell2u/images/GPL/NS0045.zip

Und auch Folgendes liefert Hinweise darauf:

strings filesystem.bin | grep dropbear
dropbearmulti
dropbearmulti
dropbear*d
dropbearkeyID
dropbearmultimd

Aber ein Portscan verlief negatief.

von Oliver J. (skriptkiddy)


Lesenswert?

Das bootfs ist ein ext2. Eventuell findest du dort etwas.


Gruß Oliver

von demacus_ (Gast)


Lesenswert?

Hallo, versuch es mal mit unsquashfs-lzma.

MfG

von hda (Gast)


Lesenswert?

Das mir dem ext2-Datei-System habe ich herausgefunden, nur leider habe 
da noch nicht brauchbares gefunden.
Ich hoffe das es im Webinterface eine versteckte Seite gibt mit der man 
ssh aktiveren kann.

unsquashfs-lzma habe ich schon probiert, ohne Erfolg.

von hda (Gast)


Lesenswert?

Mit dem Ext2-Image kommt man doch weiter.
Nach dem mounten kann man mit Hilfe der Datei (auf dem Image):
/etc/sysconfig/config/service ssh enablen.

Danach muss man das Image mit neu berechneter MD5-Summe wieder packen 
und über das Webinterface des NAS die geänderte Firmware installieren.

Jetzt kann man sich per SSH mit dem NAS verbinden, leider nur mit im 
Webinterface angelegten Nutzer-Namen.
Root-Rechte erhält man leider so nicht.

Ein su führt zu folgender Medlung:

su: setresgid: Operation not permitted

Die /etc/passwd und /etc/shadow hab ich schon angepasst (Passwortstring 
entfernt, /sbin/nologin in /bin/sh geändert).

Leider kenne ich mich mit Busybox nicht besonders aus um  dieses Problem 
zu lösen, hat einer von einen hilfreichen Tipp ?

von 7eggert (Gast)


Lesenswert?

You can use the toor user (root backwards) to get root access. Or you 
could edit /etc/passwd and replace /bin/nologin with /bin/sh.

More hints:
- Upload a tar with bootfs.bin and matching bootfs.bin.md5sum
- I needed to reset the device after uploading the changed bootfs to 
activate ssh.
- use mkpasswd to create a md5 password and store it in /etc/shadow, if 
you need to change the default passwords.

von 7eggert (Gast)


Lesenswert?

The squashfs header is non-standard. I managed to see the superblock by 
overwriting the first four bytes with "hsqs", but my squashfs doesn't do 
lzma then.

There is an open patch to support these files:
http://sourceforge.net/p/squashfs/patches/20/

Obviously I can just use the NAS to unpack the squashfs, so I'll 
probably just do that if I decide to use it.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.