{"id":13585444,"url":"https://github.com/chrivers/samsung-firmware-magic","last_synced_at":"2025-03-17T03:30:35.439Z","repository":{"id":52979424,"uuid":"254223883","full_name":"chrivers/samsung-firmware-magic","owner":"chrivers","description":"Tool for decrypting the firmware files for Samsung SSDs","archived":false,"fork":false,"pushed_at":"2021-04-11T13:08:57.000Z","size":4,"stargazers_count":217,"open_issues_count":7,"forks_count":23,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-16T07:41:30.953Z","etag":null,"topics":["decryptor","deobfuscation","firmware","firmware-extraction","samsung"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrivers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-08T23:31:03.000Z","updated_at":"2025-03-10T10:09:05.000Z","dependencies_parsed_at":"2022-09-07T20:23:35.226Z","dependency_job_id":null,"html_url":"https://github.com/chrivers/samsung-firmware-magic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Fsamsung-firmware-magic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Fsamsung-firmware-magic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Fsamsung-firmware-magic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrivers%2Fsamsung-firmware-magic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrivers","download_url":"https://codeload.github.com/chrivers/samsung-firmware-magic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243968471,"owners_count":20376400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decryptor","deobfuscation","firmware","firmware-extraction","samsung"],"created_at":"2024-08-01T15:04:56.705Z","updated_at":"2025-03-17T03:30:35.128Z","avatar_url":"https://github.com/chrivers.png","language":"Python","funding_links":[],"categories":["Python","Tools","Software Tools","💽 Autopilot Firmware"],"sub_categories":["Hardware Tools","Misc Tools","Firmware Extraction"],"readme":"Samsung Firmware Magic\n======================\n\nSamsung distributes firmware updates for their SSDs for either \"Windows\" or\n\"Mac\". Ironically, both of these are bootable Linux `.iso` files, containing the\nactual firmware and update program.\n\nThe `.iso` files can be unpacked, but ultimately we end up with an obfuscated\nbinary blob, even for the meta information.\n\nFor the upstream file downloads, see\n\n    https://www.samsung.com/semiconductor/minisite/ssd/download/tools/\n\nOut of curiosity, I decided to create a decryption tool for this obfuscated\nformat, which is found in this repository.\n\nUnpacking iso image to firmware blob\n------------------------------------\n\nFirst, we download a firmware iso:\n\n    `wget http://downloadcenter.samsung.com/content/FM/201711/20171102105105735/Samsung_SSD_850_PRO_EXM04B6Q_Win.iso`\n\nNext, we unpack the relevant file from the iso, the `initrd`:\n\n    `7z x Samsung_SSD_850_PRO_EXM04B6Q_Win.iso initrd`\n\nThis file is a gzip-compressed cpio archive, so use 7z to strip gzip:\n\n    `7z x initrd`\n\nThis produces `initrd~`, containing the uncompressed contents. From here we\nextract the directory of interest, `root/fumagician`:\n\n    `7z -ofw x 'initrd~' root/fumagician`\n\nThis creates `fw/root/fumagician` in the current directory:\n\n```\n$ cd fw/root/fumagician\n$ ls -l\ntotal 5408\n-rw-rw-r-- 1 user user    2124 1971-03-22 19:52 DSRD.enc\n-rw-rw-r-- 1 user user 4752867 1971-03-22 19:52 EXM04B6Q.enc\n-rw-rw-r-- 1 user user  772516 2016-10-14 10:42 fumagician\n-rw-rw-r-- 1 user user     290 2016-10-14 10:42 fumagician.sh\n```\n\nThe files `DSRD.enc` (xml list of firmwares) and `EXM04B6Q.enc` (firmwares)\nare the obfuscated files, that we can now decrypt.\n\nDecrypting firmware blob\n------------------------\n\nThe included `decode.py` script will unpack these `.enc` files, like so:\n\n```shell\n## show xml on stdout:\n$ ./samsung-magic.py \u003c fw/root/fumagician/DSRD.enc\n\n## decrypt firmware to file:\n$ ./samsung-magic.py \u003c fw/root/fumagician/EXM04B6Q.enc \u003e EXM04B6Q.bin\n```\n\nSeemingly, the folks at Samsung are huge fans of nesting things, because the\ndecrypted `EXM04B6Q.bin` file is actually a zip file, containing encrypted\nfirmware files:\n\n```shell\n$ unzip -l EXM04B6Q.bin\nArchive:  EXM04B6Q.bin\n  Length      Date    Time    Name\n---------  ---------- -----   ----\n  1048576  2017-02-19 10:41   EXM04B6Q_10170217.enc\n  1048576  2017-02-19 10:41   EXM04B6Q_20170203.enc\n  1048576  2017-02-19 10:41   EXM04B6Q_30170203.enc\n  1048576  2017-02-19 10:41   EXM04B6Q_40170902.enc\n  1048576  2017-02-19 10:41   EXM04B6Q_50170208.enc\n  1048576  2017-02-19 10:41   EXM04B6Q_60170208.enc\n---------                     -------\n  6291456                     6 files\n```\n\nLuckily, the encryption is exactly the same, so `samsung-magic.py` can decrypt\nthese as well:\n\n```\n$ unzip EXM04B6Q.bin\n$ ./samsung-magic.py \u003c EXM04B6Q_10170217.enc \u003e EXM04B6Q_10170217.bin\n```\n\nNow, at last, we have the raw firmware.\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrivers%2Fsamsung-firmware-magic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrivers%2Fsamsung-firmware-magic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrivers%2Fsamsung-firmware-magic/lists"}