* apt-pkg/acquire-item.cc:
authorMichael Vogt <egon@debian-devbox>
Tue, 6 Mar 2012 16:22:44 +0000 (17:22 +0100)
committerMichael Vogt <egon@debian-devbox>
Tue, 6 Mar 2012 16:22:44 +0000 (17:22 +0100)
  - 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
debian/changelog
test/integration/test-releasefile-verification

index 39ce90d..eda45d7 100644 (file)
@@ -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,
index c682990..97b9a18 100644 (file)
@@ -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 <brackets> 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 <kalnischkies@gmail.com>  Tue, 06 Dec 2011 16:35:39 +0100
+ -- Michael Vogt <mvo@debian.org>  Tue, 06 Mar 2012 14:14:26 +0100
 
 apt (0.8.15.9) unstable; urgency=low
 
index 8bf02a7..4f65cfa 100755 (executable)
@@ -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"