From b7a6594d1e5ed199a7a472b78b33e070375d6f92 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Mar 2012 17:22:44 +0100 Subject: [PATCH] * apt-pkg/acquire-item.cc: - remove 'old' InRelease file if we can't get a new one before proceeding with Release.gpg to avoid the false impression of a still trusted repository by a (still present) old InRelease file. Thanks to Simon Ruderich for reporting this issue! (CVE-2012-0214) --- apt-pkg/acquire-item.cc | 7 +++++ debian/changelog | 9 ++++-- .../integration/test-releasefile-verification | 29 +++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 39ce90dd..eda45d7b 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1608,6 +1608,13 @@ void pkgAcqMetaClearSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /* { if (AuthPass == false) { + // Remove the 'old' InRelease file if we try Release.gpg now as otherwise + // the file will stay around and gives a false-auth impression (CVE-2012-0214) + string FinalFile = _config->FindDir("Dir::State::lists"); + FinalFile.append(URItoFileName(RealURI)); + if (FileExists(FinalFile)) + unlink(FinalFile.c_str()); + new pkgAcqMetaSig(Owner, MetaSigURI, MetaSigURIDesc, MetaSigShortDesc, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc, diff --git a/debian/changelog b/debian/changelog index c6829907..97b9a182 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -apt (0.8.15.10) UNRELEASEDunstable; urgency=low +apt (0.8.15.10) unstable; urgency=high [ David Kalnischkies ] * algorithms.cc: @@ -7,6 +7,11 @@ apt (0.8.15.10) UNRELEASEDunstable; urgency=low - put around email addresses * doc/po/de.po: - apply typo-fix from Michael Basse, thanks! (LP: #900770) + * apt-pkg/acquire-item.cc: + - remove 'old' InRelease file if we can't get a new one before + proceeding with Release.gpg to avoid the false impression of a still + trusted repository by a (still present) old InRelease file. + Thanks to Simon Ruderich for reporting this issue! (CVE-2012-0214) [ Chris Leick ] * German manpage translation update @@ -27,7 +32,7 @@ apt (0.8.15.10) UNRELEASEDunstable; urgency=low Correct fi translation for hash sum mismatches (lp:420403) Thanks to Jani Uusitalo - -- David Kalnischkies Tue, 06 Dec 2011 16:35:39 +0100 + -- Michael Vogt Tue, 06 Mar 2012 14:14:26 +0100 apt (0.8.15.9) unstable; urgency=low diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 8bf02a78..4f65cfa3 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -153,6 +153,35 @@ runtest() { installaptold } +runtest2() { + prepare ${PKGFILE} + rm -rf rootdir/var/lib/apt/lists + signreleasefiles 'Joe Sixpack' + msgtest 'Cold archive signed by' 'Joe Sixpack' + aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass + + # New .deb but now an unsigned archive. For example MITM to circumvent + # package verification. + prepare ${PKGFILE}-new + find aptarchive/ -name InRelease -delete + find aptarchive/ -name Release.gpg -delete + msgtest 'Warm archive signed by' 'nobody' + aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt + failaptnew + + # Unsigned archive from the beginning must also be detected. + rm -rf rootdir/var/lib/apt/lists + msgtest 'Cold archive signed by' 'nobody' + aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt + failaptnew +} +runtest2 + + DELETEFILE="InRelease" runtest DELETEFILE="Release.gpg" -- 2.20.1