Skip to content

[Medium] Patch shim-unsigned-x64 for CVE-2024-13176 #13962

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

v-smalavathu
Copy link
Contributor

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

shim-unsigned-x64: Patch for CVE-2024-13176

Change Log
  • new file: SPECS/shim-unsigned-x64/CVE-2024-13176.patch
  • modified: SPECS/shim-unsigned-x64/shim-unsigned-x64.spec
  • modified: SPECS/shim/shim.spec
Does this affect the toolchain?

NO

Associated issues
  • #xxxx
Links to CVEs
Test Methodology
  • Pipeline build id: xxxx

Signed-off-by: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
@v-smalavathu v-smalavathu requested a review from a team as a code owner June 5, 2025 02:33
@v-smalavathu
Copy link
Contributor Author

The old version code for function "int bn_from_mont_fixed_top(..)" and current version code for function "int BN_from_montgomery(..) is the same.
Attaching snapshots..
Thanks.

image

image

@kgodara912
Copy link
Contributor

We are putting dispute for shim-unsigned-aarch64 with reason "For 2.0, we do not build shim, we only take the efi files" as per the CVE page. Are we building these files for x64?

@v-smalavathu
Copy link
Contributor Author

v-smalavathu commented Jun 5, 2025

We are putting dispute for shim-unsigned-aarch64 with reason "For 2.0, we do not build shim, we only take the efi files" as per the CVE page. Are we building these files for x64?

Yes, Initially I was in same impression and asked same thing in "Daily Stand-up [CVS-Updates]" group as shown below snapshot.
image

But, I got following response from Nikhil Vetteth
image
-Thanks

Copy link
Contributor

@kgodara912 kgodara912 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
Date: Wed, 4 Jun 2025 20:34:51 -0500
Subject: [PATCH] Address CVE-2024-13176
Upstream Patch Reference: https://github.com/openssl/openssl/commit/4b1cb94a734a7d4ec363ac0a215a25c181e11f65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are significant differences from the upstream patch. Could you please put a little summary for the changes? Like, is ec_lib.h not part of our version which is fixed in upstream?

Copy link
Contributor Author

@v-smalavathu v-smalavathu Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kgodara912 ,
Here, the summary:

  1. The affected files need to change for this CVE from Astrolab as shown below snapshot.
    image

  2. As shown from "Upstream Reference Patch", file ...crypto/ec/ec_lib.c is not part of affected file in 'Astrolab' snapshot as shown above and this file is not available in our version,

  3. The "Upstream Reference Patch" was old patch and function definition bn_from_mont_fixed_top() is not available in our version, Hence, I did back porting the changes to our version to make sure that to get same affect in our version, like
    old version code for function bn_from_mont_fixed_top() is same as function BN_mod_exp_mont() in our version, This difference captured in my first comment in this CVE.
    -Thanks

Copy link
Contributor

@kgodara912 kgodara912 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the build failure, it seems that you need to create one shim file as well.

Failed to download ...signed-shim-x86_64-15.8-2.cm2.efi). Error: invalid response: 404. 
Unable to hydrate file: signed-shim-x86_64-15.8-2.cm2.efi 

@v-smalavathu
Copy link
Contributor Author

v-smalavathu commented Jun 9, 2025

signed-shim-x86_64

I couldn't get this issue.
on my local VM, the build and test was successful without any issues.

Here, the logs attached

shim-unsigned-x64-15.8-2.cm2.src.rpm.log

shim-unsigned-x64-15.8-2.cm2.src.rpm.test.log

-Thanks

@v-smalavathu
Copy link
Contributor Author

@kgodara912 ,
Today, rebased to latest top of tree and tried to rebuild the package shim-unsigned-x64 from scratch and it was successful.
Here, the snapshots and logs attached.
image

image

shim-unsigned-x64-15.8-2.cm2.src.rpm.log

shim-unsigned-x64-15.8-2.cm2.src.rpm.test.log

Kindly let me know if I missed something here.
-Thanks

Copy link
Contributor

@Kanishk-Bansal Kanishk-Bansal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build of amd is failing

@v-smalavathu
Copy link
Contributor Author

v-smalavathu commented Jun 14, 2025

Please address the build failure, it seems that you need to create one shim file as well.

Failed to download ...signed-shim-x86_64-15.8-2.cm2.efi). Error: invalid response: 404. 
Unable to hydrate file: signed-shim-x86_64-15.8-2.cm2.efi 

I didn't find the 'signed-shim' package in 'SPECS' folder,

The following package folders are found that related to shim variants.
./SPECS/shim/shim.spec
./SPECS/shim-unsigned/shim-unsigned.spec
./SPECS/shim-unsigned-x64/shim-unsigned-x64.spec
./SPECS/shim-unsigned-aarch64/shim-unsigned-aarch64.spec

I have bumped up version in './SPECS/shim/shim.spec', Here, the current shim Version is '15.8' and Release '1' is matching with ./SPECS/shim-unsigned-x64/shim-unsigned-x64.spec, so, bumped up the version.

The other 2 variants of shim was not matching (as shown below) current version of shim and release, so I didn't bump up.

./SPECS/shim-unsigned/shim-unsigned.spec - current shim Version is '15.4' and Release is '2'
./SPECS/shim-unsigned-aarch64/shim-unsigned-aarch64.spec - current shim Version is '15' and Release is '5'

Is this any issues?
-Thanks

@kgodara912
Copy link
Contributor

Buddy build

@v-smalavathu
Copy link
Contributor Author

Buddy build

FYI
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
main PR Destined for main Packaging security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants