Skip to content

Commit

Permalink
Issue warning and refuse to proceed further if the configured
Browse files Browse the repository at this point in the history
repository signature_type is unsupported by bootstrap pkg(7).

Previously, when signature_type specified an unsupported method,
the bootstrap pkg(7) would proceed like when signature_type is
"none".  MITM attackers may be able to use this vulnerability and
bypass validation and install their own versions of pkg(8).

At this time, only fingerprint and none are supported by the
bootstrap pkg(7).

FreeBSD's official pkg(8) repository uses the fingerprint method
and is therefore unaffected.

Errata candidate.

Discussed with:	bapt@
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
  • Loading branch information
delphij committed Aug 19, 2015
1 parent 35e912e commit 671f0b9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions usr.sbin/pkg/pkg.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,13 @@ bootstrap_pkg(bool force)
goto fetchfail;

if (signature_type != NULL &&
strcasecmp(signature_type, "FINGERPRINTS") == 0) {
strcasecmp(signature_type, "NONE") != 0) {
if (strcasecmp(signature_type, "FINGERPRINTS") != 0) {
warnx("Signature type %s is not supported for "
"bootstrapping.", signature_type);
goto cleanup;
}

snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX",
getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP);
snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig",
Expand Down Expand Up @@ -855,7 +861,13 @@ bootstrap_pkg_local(const char *pkgpath, bool force)
goto cleanup;
}
if (signature_type != NULL &&
strcasecmp(signature_type, "FINGERPRINTS") == 0) {
strcasecmp(signature_type, "NONE") != 0) {
if (strcasecmp(signature_type, "FINGERPRINTS") != 0) {
warnx("Signature type %s is not supported for "
"bootstrapping.", signature_type);
goto cleanup;
}

snprintf(path, sizeof(path), "%s.sig", pkgpath);

if ((fd_sig = open(path, O_RDONLY)) == -1) {
Expand Down

0 comments on commit 671f0b9

Please sign in to comment.