Ferramentas do usuário

Ferramentas do site


modem:f2764gv

Essa é uma revisão anterior do documento!


Sagemcom F@st 2764 GV

Informações sobre o PowerBox GVT Sagemcom F@st 2764GV. Teardown, hacking, unlocking (desbloqueio), firmwares, custom images, recuperação, bridge.

Description

Teardown

Interfaces

Serial

JTAG

TFTP

Bootlog

Firmware

Format

sagemcom_header + uimage

uImage is a typical U-boot uImage, created by mkimage. The kernel also contains a simple initramfs and the main rootfs, in CramFS format, using LZMA for compression. It's linked at compile time.

The sagemcom_header is shown below:

// big endian, total size = 0x140
struct _image_header {
    /* size_until_now */
    uint32_t magic;		// 0x604c51ea
    char maybe_dsa_stuff[0x28];
    uint32_t header_crc;	// crc32 from offset 0x30 +0x7c (e.g.: on 8388 = 7D F1 77 9C)
    char dunno[8];
    char image_name[0x14];
    char dunno2[0x48];
    uint32_t image_size;
    uint32_t ac?
    uint32_t ac2
    uint32_t 86
    uint32_t header_size;	// 0x140
    uint32_t data_size;		// from header_end
    uint32_t zero;
    uint32_t zero;
    uint32_t zero;
    uint32_t zero;
    /* size_until_now = 0xac */
    char boot_args[header_size - size_until_now];
} __attribute__((packed));
 
char uimage_data[data_size];
 
// total size must be flash sector size aligned (128 KB)

Custom Firmware

Modify the device only if you own it. Most of these are provided by your ISP as part of your internet package, you just “borrowed” it. Do not install these if you don't own it.

Signed images, DSA. Impossible to generate custom ones without private part. The key lives in a secure bootloader. To circumvent this, we could:

  • generate a new keypair and modify the public key on the bootloader;
  • patch it so the check is skipped;
  • compile a new one, clean;

The second option works fine and has been tested.

Patching U-boot

To remove the signature check, read the paragraph below, and if you agree, run the tool inside your modem.

Running this tool will modify the bootloader sector of your device's flash memory. This is risky, and while the code has been tested and some checks are done at runtime, it may hard brick the modem. The only way to recover it would be via JTAG. Ensure there is no risk of power outage while running it.

Run the tool with argument 0 (disable) or 1 (enable). Running without any will show the current mode.

E.g.: will disable the signature (you want this if running custom firmware images):

# ./permstpatch 0

Download permstpatch (SHA-1: 8dd5345024ba872788040eb51b5a1d2ad9f145b0)

AC Series

The AC Series1) (vAC01, vAC02, …) are modified versions based on stock images, either to remove useless stuff or add new features, without having to resort to compile everything again. The sources are available 2), but getting them to work properly wouldn't be easy.

These will only run after patching the u-boot. With your patched bootloader, you can either boot this image via TFTP (not permanent, for testing only) or burn it permanently to your flash. Remember, there is always a risk on every flash write operation.

Some stuff from the original package needs to be removed to make room for the new files. No, it can't grow bigger than what the original FS was.

vAC01
  • Removed / Modified
    • All PNG images crushed to reduce size. Some may lost a bit of quality;
    • Duplicated JS files
    • mkfs.* tools - do it from your machine
    • fsck.* tools - above ^
    • badblocks
    • gdbserver
  • Added
    • Busybox v1.01 with a bunch more applets (same version though, from official source pkg);
    • Dropbear SSH daemon (running on port 8022, default credentials root:root);
    • xDSL stats dump page ( append /stats to dev's page URL (original idea by sibisties)); not yet
    • rg_conf_set
    • crond

Download (SHA-1: 5439718359e2b696665affcf2657934c67386d25)

vAC02
  • Fix permanent passwd path check (thanks revertex);
  • Fix wrong samba status file path (thanks revertex);
  • Move samba_global.conf to JFFS2 (/mnt/jffs2/samba_global.conf). It'll populate with the default one at first run;
  • Add etherwake;
  • Smaller (removed some applets too) Busybox binary;

Download (SHA-1: 9faeb96f4b0624017a9e576c2bc7dc357da6c6aa)

Installation

Portuguese only for now.

Substitua vACxx pela versão que estiver utilizando (e.g.: vAC01).

  1. Baixe o permstpatch e a imagem vACxx mais recente (FAST2764_vACxx.img);
  2. Coloque uma cópia destes dois arquivos no diretório raiz de um pen-drive formatado em FAT32 ou ext2/3. Estes serão levados para o modem;
  3. Baixe e execute o flashcustom em seu PC (por ora, somente Windows);
  4. Siga os passos na ferramenta para habilitar imagens custom no modem. Quando a ferramenta solicitar para conectar o disco removível e aguardar, plugue o pen-drive do passo 2 no modem;
  5. Havendo sucesso, envie a imagem vACxx que baixou anteriormente via TFTP;
  6. Após a carga e o modem iniciar, já estará com a versão custom! Porém, é temporário, e voltará ao normal quando reiniciar o modem.

Caso queira torná-la permanente:

  1. Conecte via SSH no modem com PuTTY ou outro cliente (porta 8022, root:root);
  2. Acesse a pasta onde está o pen-drive:
      cd /mnt/usb/*/
  • Caso dê erro, tente recolocar o drive e aguardar alguns segundos para tentar novamente. Se mesmo assim ainda não aparecer, a porta USB pode estar desativada. Execute o comando abaixo, aguarde e tente novamente:
      /etc/rcS.d/S30_gpio_usb START
  1. Grave a imagem com os seguintes comandos (alguns podem levar cerca de 30 s para terminar, é normal):
      dd if=FAST2764_vACxx.img of=/dev/mtdblock0 bs=128k
      sync
      reboot

TFTP Upload

Quando uma firmware é transferida via TFTP para o modem ela é executada mas não é salva na memória flash. É preciso acessar o console dele para salvá-la na ROM.

Windows

Para fazer o upload da firmware via TFTP, pode ser utilizado o programa “tftpd64” ou “tftpd32” (a depender da sua versão do Windows)

Ajustando o servidor TFTP

Ajustando o DHCP Server

A continuar…

Acknowledgment

People involved in discussions, tips, help or general chat. List in alphabetical order.

facsi, Jonathan Amend, navossoc, ofumeta, woytekm.
1)
named after my cute girl, btw
modem/f2764gv.1477086452.txt.gz · Última modificação: 2022/11/07 11:31 (edição externa)