====== Sagemcom F@st 2764 GV ====== {{description>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 ==== 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) ** Para esse método funcionar, você deve ligar o cabo de rede DIRETAMENTE no seu computador. A utilização de um router no meio do computador e do modem pode resultar em falha no processo! ** Ajustando o servidor TFTP Configure o seu computador para IP fixo e abra o tftpd. Clique em settings. Marque as caixas: TFTP Server DHCP Server Na aba TFTP: O diretorio base é onde está sua firmware Não precisa mudar nenhuma opção. So verifique se o IP em BIND IP está setado para seu ip fixo. Na aba DHCP: coloque "./nomedafirmware.bin" sem as aspas em "boot file" Verifique que o seu ip fixo está em BIND DHCP to this address. Coloque seu modem na tomada segurando o botao vermelho RESET embaixo do aparelho. As luzes deverão piscar de uma maneira diferente. Aguarde que a firwmare deverá ser passada para o aparelho. ===== Bootlog ===== ===== Firmware ===== === Format === sagemcom_header + uimage uImage is a typical [[wp>Das_U-Boot|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, [[wp>Digital_Signature_Algorithm|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 [[modem:f2764gv#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 [[https://www.tripleoxygen.net/files/devices/sagemcom/f2764gv/tool/permstpatch|Download permstpatch]] (SHA-1: 8dd5345024ba872788040eb51b5a1d2ad9f145b0) === AC Series === The AC Series((named after my cute girl, btw)) (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 ((http://www.opensource-code.com/index.php?id=56)), but getting them to work properly wouldn't be easy. These will only run **after** [[modem:f2764gv#Patching U-boot|patching the u-boot]]. With your patched bootloader, you can either boot this image via [[f2764gv#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** [[https://www.tripleoxygen.net/files/devices/sagemcom/f2764gv/firmware/custom/FAST2764_vAC01.img|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; [[https://www.tripleoxygen.net/files/devices/sagemcom/f2764gv/firmware/custom/FAST2764_vAC02.img|Download]] (SHA-1: 9faeb96f4b0624017a9e576c2bc7dc357da6c6aa) == Installation == Portuguese only for now. Substitua vACxx pela versão que estiver utilizando (e.g.: vAC01). - Baixe o [[modem:f2764gv#Patching U-boot|permstpatch]] e a imagem [[modem:f2764gv#AC Series|vACxx mais recente]] (FAST2764_vACxx.img); - 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**; - Baixe e execute o [[https://www.tripleoxygen.net/files/devices/sagemcom/f2764gv/tool/flashcustom.zip|flashcustom]] em seu PC (por ora, somente Windows); - 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; - Havendo sucesso, envie a imagem vACxx que baixou anteriormente via [[modem:f2764gv#TFTP]]; - 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: - Conecte via SSH no modem com PuTTY ou outro cliente (porta 8022, root:root); - 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 - 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 == Acknowledgment == People involved in discussions, tips, help or general chat. List in alphabetical order. facsi, Jonathan Amend, navossoc, ofumeta, woytekm.