Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCI ID '0x1578' has no known signatures. #3

Open
chris-day opened this issue Oct 25, 2020 · 12 comments · May be fixed by #4
Open

PCI ID '0x1578' has no known signatures. #3

chris-day opened this issue Oct 25, 2020 · 12 comments · May be fixed by #4
Labels
bug Something isn't working needinfo Need more info from reporter question Further information is requested

Comments

@chris-day
Copy link

chris-day commented Oct 25, 2020

Fails to identify on a Lenovo P70 with the following information and wanting to patch a Lenovo Thunderbolt 3 dock (Model=AC)

DeviceInstanceId PCI\VEN_8086&DEV_1578&SUBSYS_11112222&REV_00\5&2B3F6D8&0&0000E4

Please find the attached TBT.bin file for your perusal.

Q: Is the patching actually successful i.e. would applying the patched firmware work ?
TBT.zip

2020-10-26 09:09:30,743 - WARNING - PCI ID '0x1578' has no known signatures. Ignoring PCI ID and trying all patterns instead.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Security Level : SL1

When patching;

2020-10-26 09:10:19,582 - WARNING - PCI ID '0x1578' has no known signatures. Ignoring PCI ID and trying all patterns instead.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Security Level : SL1

2020-10-26 09:10:19,590 - WARNING - PCI ID unsupported, but current SL detected through heuristics. Patching may fail.
Image patched successfully.

chrisd@edmund:tcfp > ab-python3 tcfp.py parse TBT.bin
2020-10-26 09:11:30,163 - WARNING - PCI ID '0x1578' has no known signatures. Ignoring PCI ID and trying all patterns instead.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Security Level : SL0

@BjornRuytenberg BjornRuytenberg added the question Further information is requested label Oct 26, 2020
@BjornRuytenberg
Copy link
Owner

Thanks for the question. It looks like your attached firmware is the patched version. To better answer your question, could you please post the original dump?

@chris-day
Copy link
Author

Hi Bjorn -

This is the original dump
TBT.bin.zip

I did try patching although the SL remains at SL1

image

Appreciate a mechanism to force SL0

@BjornRuytenberg BjornRuytenberg linked a pull request Oct 31, 2020 that will close this issue
@BjornRuytenberg
Copy link
Owner

Hi Chris,

Thanks for the original dump and info.

Your report has been a very good use case for me to add several new features, including:

  • Generating verbose output by passing -v: 51767b0
  • Improving heuristics: 5243477
  • Adding support for partial dumps and incremental firmware updates: fe55fe3

Meanwhile, it also let me squash a bug in signature matching (fd43917).

I don't have access to a DSL6540 on NVM 25, but PR #4 tracks adding support for this particular configuration. The signatures in 341f22f are based on my analysis of the same model on a different NVM. I'd say there's a fair chance patching will work, so please let me know whether this works for you.

Before going into the steps to test -- I've noticed your image is not a full dump, but is missing the "scratch pad" section where host-initiated firmware updates are temporarily stored. It looks like you haven't updated the host controller firmware before. This should not be a particular issue when it comes to patching, so you may safely ignore the related warning.

To test, first clone the branch:

$ git clone --single-branch --branch "0x1578-support" https://github.com/BjornRuytenberg/tcfp

Parse and patch the image:

$ python3 tcfp.py parse TBT.bin.org
2020-10-31 22:17:37,233 - WARNING - File size in between 229376 and 1048576 bytes. Possible causes:
 - Image comprises not a full dump, but an incremental firmware update. Please note SL state parsing and patching might not be available.
 - Image dump may be incomplete, i.e. not include 'scratch pad' section. However, this should typically not cause any issues.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Image type : Incremental
Security Level : SL1

$ python3 tcfp.py patch TBT.bin.org
2020-10-31 22:17:42,046 - WARNING - File size in between 229376 and 1048576 bytes. Possible causes:
 - Image comprises not a full dump, but an incremental firmware update. Please note SL state parsing and patching might not be available.
 - Image dump may be incomplete, i.e. not include 'scratch pad' section. However, this should typically not cause any issues.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Image type : Incremental
Security Level : SL1

Image patched succesfully.

$ python3 tcfp.py parse TBT.bin.org
2020-10-31 22:17:47,629 - WARNING - File size in between 229376 and 1048576 bytes. Possible causes:
 - Image comprises not a full dump, but an incremental firmware update. Please note SL state parsing and patching might not be available.
 - Image dump may be incomplete, i.e. not include 'scratch pad' section. However, this should typically not cause any issues.
Vendor ID : 0x109
PCI ID : 0x1578
PCI Device Name : DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
Model ID : 0x7070
NVM version : 25 (0x19)
Vendor : Lenovo
Device : Payton1 P70
Image type : Incremental
Security Level : SL0

@BjornRuytenberg BjornRuytenberg added the bug Something isn't working label Oct 31, 2020
@chris-day
Copy link
Author

chris-day commented Nov 1, 2020

Hi Bjorn -

Glad this is of some help. I've repeated the steps you mentioned with has lead to another interesting issue. Whilst I think we have now patched the PC controller, the Thunderbolt dock firmware has SL1 set (https://pcsupport.lenovo.com/gb/en/products/accessory/docks/thinkpad-thunderbolt-3-dock/40ac/40ac0135dk/zbk01v1u/downloads/driver-list/

I've attached the firmware for you investigation as parsing works but patching fails;

Lenovo_ThinkPad_Thunderbolt3Dock_AR_EP_4C_C0_rev44_W_Ti_v138_SEC6_sign.zip

2020-11-01 09:48:14,143 - WARNING - File size in between 229376 and 1048576 bytes. Possible causes:

  • Image comprises not a full dump, but an incremental firmware update. Please note SL state parsing and patching might not be available.
  • Image dump may be incomplete, i.e. not include 'scratch pad' section. However, this should typically not cause any issues.
    Vendor ID : 0x108
    PCI ID : 0x15d3
    PCI Device Name : JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016]
    Model ID : 0x1630
    NVM version : 1 (0x1)
    Vendor : Lenovo
    Device : ThinkPad Thunderbolt 3 Dock
    Image type : Incremental
    Security Level : SL1

2020-11-01 09:48:38,942 - WARNING - File size in between 229376 and 1048576 bytes. Possible causes:

  • Image comprises not a full dump, but an incremental firmware update. Please note SL state parsing and patching might not be available.
  • Image dump may be incomplete, i.e. not include 'scratch pad' section. However, this should typically not cause any issues.
    Vendor ID : 0x108
    PCI ID : 0x15d3
    PCI Device Name : JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016]
    Model ID : 0x1630
    NVM version : 1 (0x1)
    Vendor : Lenovo
    Device : ThinkPad Thunderbolt 3 Dock
    Image type : Incremental
    Security Level : SL1

Error while processing firmware image: PCI ID supported, but no patch pattern available for this SL signature. Aborting
.

@BjornRuytenberg
Copy link
Owner

BjornRuytenberg commented Nov 1, 2020

Hi Chris,

Glad this is of some help. I've repeated the steps you mentioned with has lead to another interesting issue. Whilst I think we have now patched the PC controller, the Thunderbolt dock firmware has SL1 set

That's great. Could you post a screenshot of the same Thunderbolt "Details" screen you posted earlier, after flashing the patched firmware? Then I can make sure everything else also checks out, and merge PR #4 into master.

I've attached the firmware for you investigation as parsing works but patching fails;

The short answer to your second question: SL state in Thunderbolt devices won't be an issue. The Thunderbolt host controller in your laptop/PC dictates the current SL state, that is, the SL you've chosen in your BIOS (or patched into controller firmware using tcfp :-)). If the "Details" screen above says SL0, and any TB devices indeed connect immediately, you're all set.

The long answer: The Lenovo Thunderbolt dock features an Alpine Ridge controller. The interesting thing is that some of this generation's models are capable of running in both host (laptop/PC) and endpoint (device) mode. This means AR firmware has sections intended to store configuration parameters for both modes. As you can probably guess, though, only one mode can be active at any one time. For this reason, it is customary that vendors wipe the inactive section -- as this is device controller firmware, I'm rather surprised to see Lenovo left this bit in there.

So, to sum it up, tcfp reports SL1 because that's what it parsed from the (inactive) host mode section. If you were to hypothetically flash the dock's firmware onto a host controller SPI flash (and enabled host mode), this means it would enable SL1 ;-).

If you're interested, you can find more technical details in my recent Black Hat talk:

@chris-day
Copy link
Author

Hi Bjorn - unfortunately nothing has changed in the Thunderbolt "Details" screen after applying the patched firmware (TBT). The report is still SL1.

I'm wondering if we do need to patch the Thunderbolt dock instead?

@BjornRuytenberg
Copy link
Owner

Hi Chris,

I just had another look at your original dump in #3 (comment), and it seems like more sections are missing than I originally noticed. Just to verify, can you share how you made the dump? Specifically,

  • What SPI programmer (e.g. model, board revision, firmware if applicable) did you use?
  • What tool to interface with the programmer (e.g. something vendor proprietary or flashrom) and settings (e.g. SPI bus speed, UART speed) did you use?

I'm wondering if we do need to patch the Thunderbolt dock instead?

Thunderbolt devices should not affect the SL state of the laptop. If they do, that would have been a very bad security design. (I realize Thunderspy doesn't exactly speak in Intel's favor, but their design was not that bad ;-)).

That said, Thunderbolt controllers are full of proprietary mysteries. Feel free to patch the Thunderbolt dock firmware -- happy to hear what you find. For this procedure, note that you will need to make a full dump using a SPI programmer. The firmware you linked in #3 (comment) is in an incremental firmware update, and so while tcfp will parse it correctly, it cannot be used for patching.

@BjornRuytenberg
Copy link
Owner

Got any updates? I'd be happy to analyze this further for you, but I'll need more info at this point.

@BjornRuytenberg BjornRuytenberg added the needinfo Need more info from reporter label Nov 15, 2020
@chris-day
Copy link
Author

chris-day commented Nov 16, 2020

Hi Bjorn - I'm unsure how to progress this as I don't have an SPI programmer. (Ultimately I just want to be able to set the level to SL0 so the system will boot rather than freeze).

Of note, there is a new firmware for the dock that has been published this month - https://support.lenovo.com/gb/en/downloads/ds506115-firmware-update-tool-for-windows-10-64-bit-thinkpad-thunderbolt-3-dock-40ac

@BjornRuytenberg
Copy link
Owner

BjornRuytenberg commented Nov 18, 2020

Hi Chris,

I'm unsure how to progress this as I don't have an SPI programmer.

I see. That explains the firmware image identifying as an update.

(Ultimately I just want to be able to set the level to SL0 so the system will boot rather than freeze).

Just to verify, do you mean:

  1. Booting from the internal HDD/SSD, with the Lenovo Thunderbolt dock connected?
  2. Booting from the internal HDD/SSD, without the dock connected?
  3. Booting from an external Thunderbolt-powered HDD/SSD?

If it's case 1:
There are three situations I can currently think of:

  • Your system supports and enables Kernel DMA Protection, and the dock requires drivers that don't support this protection. In this case, I would recommend looking for driver updates for the dock on Lenovo's website. If this doesn't help, you might need to consider disabling Kernel DMA Protection (if present). Note that this will render your system fully vulnerable to Thunderspy. Alternatively, you might want to consider replacing the dock.
  • Your system supports and enables Kernel DMA Protection. In Windows 10 build 2004 specifically, there have been issues causing Thunderbolt hardware to freeze/BSOD systems. However, to my knowledge, this has been recently addressed with a Windows update.
  • From Windows 10 build 2004 onward, some Thunderbolt controllers have power management issues causing intermittent connectivity, BSODs, or no connectivity at all. A user observing this behavior reported to me that using Spycheck, and installing its custom power management driver, solved this issue. If you've verified all currently available Windows updates have been installed, you might want to have a look at this avenue.

If it's case 2 or 3:
Rather than using tcfp (and having to buy a SPI programmer), I would recommend trying to update your laptop's BIOS and Thunderbolt host controller firmware. You can find both on Lenovo's website.

Of note, there is a new firmware for the dock that has been published this month - https://support.lenovo.com/gb/en/downloads/ds506115-firmware-update-tool-for-windows-10-64-bit-thinkpad-thunderbolt-3-dock-40ac

While I think chances are small this would solve the issue, it should be (relatively) safe to apply this firmware update. Feel free to try.

@BjornRuytenberg
Copy link
Owner

Hi Chris,

Got any updates? It would be good to know what's causing the issue you're seeing -- your findings may be valuable to other users, too.

@chris-day
Copy link
Author

Hi Bjorn - the Windows 10 update has resolved the issue with the freezing post the login screen. I'm unable to perform the full firmware dump but I'm open to how we can do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needinfo Need more info from reporter question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants