Skip to content

Add new debian database in libcd#2572

Closed
dgagn wants to merge 4 commits intoGallopsled:devfrom
dgagn:feat/debian-libcd
Closed

Add new debian database in libcd#2572
dgagn wants to merge 4 commits intoGallopsled:devfrom
dgagn:feat/debian-libcd

Conversation

@dgagn
Copy link

@dgagn dgagn commented Mar 31, 2025

This PR extends _find_libc_package_lib_url to support Debian-based libc packages from the SIPWISE security mirror. It's useful for GLIBC 2.36-9+deb12u6.

@dgagn dgagn changed the title Add libcd new debian database for urls Add new debian database in libcd Mar 31, 2025
@peace-maker
Copy link
Member

Thanks for the contribution. What problem does this fix? What's sipwise and why that mirror explicitly?

@dgagn
Copy link
Author

dgagn commented Mar 31, 2025

Thanks for the contribution. What problem does this fix? What's sipwise and why that mirror explicitly?

The problem is that some version of libc, such as 2.36-9+deb12u6 cannot be downloaded from the standard debian mirror because of vulnerabilities found in them. The only reason for using the sipwise mirror is that it provides old debian libc versions. The sipwise mirror is the first (and only?) one that hosts the version 2.36-9+deb12u6. I had that specific version in a ctf.

pwnlib/libcdb.py Outdated
yield 'https://launchpad.net/ubuntu/+archive/primary/+files/libc6_{}_{}.deb'.format(libc_version, libc.arch)

# check debian.sipwise.com if it's a debian libc
maybe_deb_version = maybe_deb_version.split('/')[-1]
Copy link
Member

Choose a reason for hiding this comment

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

This throws AttributeError if maybe_deb_version is None, please move under the if below.

maybe_deb_version = None
if libc_match is not None:
for match in libc_match:
# Allow to override url with a caching proxy in CI
Copy link
Member

Choose a reason for hiding this comment

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

We still need this in our testing pipeline to get a speedup.

pwnlib/libcdb.py Outdated
# check debian.sipwise.com if it's a debian libc
maybe_deb_version = maybe_deb_version.split('/')[-1]
if maybe_deb_version is not None:
yield 'https://debian.sipwise.com/debian-security/pool/main/g/glibc/{}'.format(maybe_deb_version)
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe (?) verify debian signatures if this is a third-party db. I just realized the same goes for our http urls by the way (MITM and so on).

Copy link
Author

Choose a reason for hiding this comment

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

Perfect, i'll figure this out, thank you.

@peace-maker
Copy link
Member

@dgagn Poke! Do you still plan on working on this PR?

@peace-maker
Copy link
Member

I think instead of hardcoding a thirdparty apt mirror we should look into some way to allow to add additional mirrors via e.g. an environment variable and/or argument to download_libraries. We can add the sipwise mirror as an example in the documentation. Thank you for your time @dgagn either way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants