Web、サーバ、ソフトウェア、バグ・脆弱性 などの情報を何人かで集まって書いていく IT/Web情報系ブログ

BadUSB(Psychson) on PS2251-07(2307) 続報

投稿日:   最終更新日:2017/04/01  投稿者:xx2zz


2017年04月01日 追記
以下の記事を参照してください。
【完全版】PS2251-07(2307)用Psychson(BadUSB)パッチの適用方法
Please refer to the following article.
【Complete version】How to apply PS2251-07(2307) patch for Psychson(BadUSB)

以前、Phison 2251-07 (2307)でPsychsonのファームウェアを動かすことに成功したことを報告したが、実はその時点では新しいバージョンの2307チップにファームを書き込むことが完全にはできていなかった。(詳細は後述)

今回はその新しいバージョンの2307チップでもPsychsonのファームウェアを動かすことに成功したので、その詳細を記す。

2016年07月08日 追記
CFWの差分を公開した

スポンサーリンク

海外版チップの罠

日本国内では、Phisonチップを積んだUSBメモリとして「Toshiba TransMemory-MX USB 3.0 8GB/16GB」が安く手に入るが、この東芝製USBメモリには国内版と海外版(並行輸入品)の2つの製品がある。価格は国内版のほうが200~300円高く、搭載されているチップのIDとファームウェアのバージョンも異なっている。

Action specified: GetInfo
Gathering information...
Reported chip type: 2307
Reported chip ID: 98-DE-98-92-72-50
Reported firmware version: 2.03.53
Mode: Firmware
Action specified: GetInfo
Gathering information...
Reported chip type: 2307
Reported chip ID: 98-3A-98-A3-76-51
Reported firmware version: 2.15.55
Mode: Firmware

パッケージも異なる。(左が海外版。右が国内版)
toshiba

2307のUSBメモリにファームウェアを書き込む場合、まず http://www.usbdev.ru/files/phison/ps2307fw/ で公開されているバーナーイメージを実行させた後ファームウェア本体を書き込むが、1月時点で公開されていた最新のバーナー(BN07V106M.BIN)が国内版(98-DE-98-92-72-50)では動くが、海外版(98-3A-98-A3-76-51)では正しく動かなかった。
前回の報告は国内版でのみの成功に関するものであった。
具体的には、実行することはできるがファームウェアのダンプと書き込みが機能していない状態だった。

そのため、1月時点では海外版(98-3A-98-A3-76-51)で2307向けのカスタムファームウェアを動作させることが出来なかった。

新しいバーナーが降ってきた

最近になって「BN07V502TAW.BIN」という新しいバージョンのバーナーファイルが公開されていたので、このバーナーで海外版(98-3A-98-A3-76-51)でもカスタムファームウェアを書き込むことができないか試してみることにした。

まず、BN07V502TAW.BINを国内版チップで実行し、 BN07V106M.BINで書き込んだファームウェアをダンプしてみたところ、やたらとエントロピーが高いデータが吐き出された。

dump

バーナーに同封されていた公式ファームウェア「FW07V50253TW.BIN」を見ると、どうやら同じようなパターンの値が見られるので、でたらめなデータが吐かれたわけではなく、元データになんらかの暗号化が施されているものと推測した。

海外版(98-3A-98-A3-76-51)に対しても、BN07V502TAW.BINで同じようなパターンのダンプを得ることができたので、BN07V106M.BINとは違いフラッシュメモリからのデータの読み取り自体はうまくいっているものと考えた。

おそらく、この暗号化された状態のファームウェアであればフラッシュメモリに書き戻すこともできるだろうが、暗号化の手順が分からなければカスタムファームウェアを書き込むことが出来ないため、次の2つのアプローチでどうにかできないか検討した。

(A) 暗号化の詳細な手順を突き止め、自前で暗号化したカスタムファームウェアをBN07V502TAW.BINで書き込む

(B) BN07V502TAW.BINを改造して暗号化を回避してファームウェアのダンプ・書き込みを出来るようにする

試行錯誤の結果

調査・検討の結果、暗号化の手順を突き止めることは非常に困難であると分かったので、(B)案を試すことにした。

試行錯誤の末、BN07V502TAW.BINにパッチを当てることで、暗号化を回避して(生の状態の)ファームウェアのダンプ・書き込みが行えるようになった。

そして、海外版(98-3A-98-A3-76-51)でも、パッチを当てたBN07V502TAW.BINでPsychsonのカスタムファームウェアを書き込み、

動作させることに成功した。

drivecom


When you have some questions and want to get reply from us, you have to notify us the version of the chip and other important information.

- BadUSB , , , , ,

Comment

  1. Adam より:

    Can someone translate this to english? even with google translate I cant make it through the first few steps. For example, which files are we meant to patch in the first part?

  2. Aidyn より:

    So how did you resolve the problem? Do we have to use the BN07V502TAW.BIN as a source for asm code implantation into firmware source? Which steps to take?

  3. xoxoibo より:

    I have two questions where did you get the action SendFirmware07, did you write it? And why are you executing the action without a burner parameter?
    I cant get this working even with the BN07V502TAW.BIN maybe I am missing something

    • xx2zz より:

      >I have two questions where did you get the action SendFirmware07, did you write it? And why are you executing the action without a burner parameter?

      “SendFirmware07” is equivalent to “SendFirmware” that patched http://vivibit.net/psychson2307/.

      >I cant get this working even with the BN07V502TAW.BIN maybe I am missing something

      The BN07V502TAW.BIN returns the encrypted data by the “Pseudo Random XOR scrambler” of the phison controller.
      It is necessary to rewrite BN07V502TAW.BIN a few bytes if you want to bypass the encryption.
      Please see the following for more information about the “Pseudo Random XOR scrambler”.
      https://bitbucket.org/flowswitch/phison/wiki/PS2303NDP

      • Nathan より:

        I have read the “Random XOR Scrambler Pseudo” page, but I am still unsure of how I need to rewrite BN07V502TAW.BIN.

        The page says
        -038 SCRAMMODE
        -Scrambler mode. Clear bit 7 and set bits 3, 4 to bypass scrambler.

        In BN07V502TAW.BIN, there is no value on 0038. Is this what I should edit? Or do I edit NANDCSOUT registers?

        I am working with a Kingston DataTraveler 100 G3 8GB (2251-07) PS2307 Controller.

        Drivecom has given me this so far:

        ———————
        BEFORE ANY CHANGES
        C:\Psychson-master\tools>DriveCom /Drive=F /action=GetInfo
        Action specified: GetInfo
        Gathering information…
        Reported chip type: 2307
        Reported chip ID: 98-DE-88-A3-72-51
        Reported firmware version: 1.02.55
        Mode: Firmware

        ————————————-
        AFTER ATTEMPTING TO SEND FIRMWARE

        C:\Psychson-master>tools\drivecom /drive=F /action=GetInfo
        Action specified: GetInfo
        Gathering information…
        Reported chip type: 2307
        Reported chip ID: 98-DE-88-A3-72-51
        Reported firmware version: 1.06.10
        Mode: Burner

        Notice how the reported firmware has been changed in the second GetInfo after I tried to sendfirmware. It is also in Burner mode. Not sure if this means anything.

        Anyway, I just need help figuring how to rewrite the BN07v502TAW.BIN. Anything is appreciated, thank you for your time.

        • xx2zz より:

          Wasn’t it successful with the BN07V106M.BIN? (BN07V106M.BIN does not encrypt(decrypt) the firmware)

          • Nathan より:

            Using Drivecom to send firmware BN07V106M.BIN gave me this:

            Psychson-master>tools\drivecom /drive=f /action=SendFirmware /burner=Burner\BN07V106M.BIN /firmware=firmware\bin\fw.bin
            Action specified: SendFirmware
            Gathering information…
            Reported chip type: 2307
            Reported chip ID: 98-DE-88-A3-72-51
            Reported firmware version: 1.06.10
            Mode: Burner
            Rebooting…
            Sending firmware…
            FATAL: System.InvalidOperationException: Header not accepted
            at DriveCom.PhisonDevice.TransferFile(Byte[] data, Byte header, Byte body) in c:\Users\User\Desktop\New folder\Psychson-master\DriveCom\DriveCom\PhisonDevice.cs:line 256
            at DriveCom.Startup._RunFirmware(String fileName) in c:\Users\User\Desktop\New folder\Psychson-master\DriveCom\DriveCom\Startup.cs:line 427
            at DriveCom.Startup._SendFirmware() in c:\Users\User\Desktop\New folder\Psychson-master\DriveCom\DriveCom\Startup.cs:line 378
            at DriveCom.Startup.Main(String[] args) in c:\Users\User\Desktop\New folder\Psychson-master\DriveCom\DriveCom\Startup.cs:line 114

          • xx2zz より:

            >In BN07V502TAW.BIN, there is no value on 0038. Is this what I should edit? Or do I edit NANDCSOUT registers?
            It is “F638”, not “0038”.

            See this comments: http://vivibit.net/psychson2307/#comment-5958.

Message

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

関連記事