]> git.saurik.com Git - apt.git/commitdiff
testcase for CVE-2012-0214
authorSimon Ruderich <simon@ruderich.org>
Sat, 3 Mar 2012 10:44:06 +0000 (11:44 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sat, 3 Mar 2012 10:44:06 +0000 (11:44 +0100)
test/integration/test-releasefile-verification

index 8bf02a78fbdc8e642ccf65773c666d04faf47298..4f65cfa3b384472d3142508d9bdbb6834abd69a4 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"