Bug 604709 (CVE-2010-1000) - VUL-0: CVE-2010-1000: kget metalink directory traversal
Summary: VUL-0: CVE-2010-1000: kget metalink directory traversal
Status: RESOLVED FIXED
: 687873 (view as bug list)
Alias: CVE-2010-1000
Product: SUSE Security Incidents
Classification: Novell Products
Component: General (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Deadline: 2010-12-03
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard: maint:running:33269:important maint:r...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 11:59 UTC by Ludwig Nussel
Modified: 2018-07-31 08:41 UTC (History)
6 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
kget_CVE-2010-1000.diff (7.36 KB, patch)
2010-05-11 12:00 UTC, Ludwig Nussel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ludwig Nussel 2010-05-11 11:59:35 UTC
Your friendly security team received the following report via security@suse.de.
Please respond ASAP.
This issue is not public yet, please keep any information about it inside SUSE.
Note that build.opensuse.org *cannot* be used to prepare embargoed updates.

Specially crafted metalink files could cause kget to download files into directories other than the one the user selected.
Comment 2 Ludwig Nussel 2010-05-11 12:00:15 UTC
Created attachment 361279 [details]
kget_CVE-2010-1000.diff
Comment 3 Will Stephenson 2010-05-11 12:31:38 UTC
All KDE 4 versions are affected and the metalink code was substantially rewritten for 4.4, requiring the patch to be rewritten for the older versions.
Comment 4 Ludwig Nussel 2010-05-11 12:41:59 UTC
kget itself is only on 11.2 so I guess the bug is actually in kdelibs4?
Comment 5 Ludwig Nussel 2010-05-11 12:43:26 UTC
it's kdenetwork4
Comment 6 Swamp Workflow Management 2010-05-11 12:49:23 UTC
The SWAMPID for this issue is 33269.
This issue was rated as important.
Please submit fixed packages as soon as possible.
When done, please reassign the bug to security-team@suse.de.
Patchinfo will be handled by security team.
Comment 7 Will Stephenson 2010-05-12 10:56:11 UTC
Submitted for SLE11, SLE-11-SP1, openSUSE 11.1, openSUSE 11.2, and patched in openSUSE:Factory.
Comment 8 Thomas Biege 2010-05-12 11:49:02 UTC
Will,
is this package really on SLE11? I cannot find it.
Comment 9 Will Stephenson 2010-05-12 12:45:48 UTC
Yes, SUSE:SLE-11:GA kdenetwork4
Comment 10 Thomas Biege 2010-05-14 07:36:03 UTC
mass change P5 -> P3
Comment 12 Thomas Biege 2010-05-14 09:34:50 UTC
Will, did we also fixed this one?
    "2) In some versions of KGet (2.4.2) a dialog box is displayed allowing the
    user to choose the file to download out of the options offered by the
    metalink file. However, KGet will simply go ahead and start the download
    after some time - even without prior acknowledgment of the user, and
    overwriting already-existing files of the same name. (CVE-2010-1511)"
Comment 13 Will Stephenson 2010-05-17 07:51:49 UTC
Not necessary we haven't shipped the affected versions (2.4.0, 2.4.1, 2.4.2) in products, and 2.4.3 that will be in 11.3 is fixed upstream.
Comment 14 Marcus Meissner 2010-05-25 11:35:09 UTC
i see no submission in done/SLES11 nor in done/SLES11-SP1 ? DId you submit them?
Comment 15 Ruediger Oertel 2010-05-28 10:45:00 UTC
what's the status here, can the patchinfos be canceled ("package not affected")
or are we still waiting for fixes ?
Comment 16 Marcus Meissner 2010-05-28 12:11:52 UTC
Will?
Comment 17 Matthias Weckbecker 2010-06-10 11:56:43 UTC
Since dirk told me that our packages are not affected by this issue I've cancelled the workflow + this bug.
Comment 18 Swamp Workflow Management 2010-06-10 12:19:31 UTC
The SWAMPID for this issue is 33269.
This issue was rated as moderate.
Please submit fixed packages as soon as possible.
When done, please reassign the bug to security-team@suse.de.
Patchinfo will be handled by security team.
Comment 19 Marcus Meissner 2010-06-10 13:09:52 UTC
needinfo satiosfied by Dirk.
Comment 24 Thomas Biege 2010-08-03 09:03:11 UTC
Any news here?
Comment 25 Dirk Mueller 2010-09-29 16:48:32 UTC
I wrote this test application: 



#include <QtTest/QtTest>
#include <qregexp.h>

bool check(const QString& name)
{
     if (name.contains(QRegExp("$(\\.\\.?)?/")) || name.contains("/../") || name.endsWith("/.."))
         return true;

     return false;
}

void test()
{
    QString test("/../foo/bla");

    qDebug() << "1" << check("/../foo/bla");
    qDebug() << "2" << check("../foo/bla");
    qDebug() << "3" << check("bla/../foo/bla");
    qDebug() << "4" << check("foo/bla/..");
    qDebug() << "5" << check("foo/bla");
}

int main()
{
    test();

    return 0;
}

the output is: 

1 true 
2 false 
3 true 
4 true 
5 false 

Therefore I believe the patch is broken.
Comment 26 Ludwig Nussel 2010-10-05 12:28:02 UTC
Will, could you please fix the patch and submit new packages?
Comment 27 Will Stephenson 2010-10-06 12:59:21 UTC
I rewrote Dirk's test case to check the expected results.  Am I right in understanding that all 5 tests should return true from check() as shown below?

If so removing the initial $ from the regexp seems sufficient.

#include <QtTest/QtTest>
#include <qregexp.h>

bool check(const QString& name)
{
    if (name.contains(QRegExp("(\\.\\.?)?/")) || name.contains("/../") ||
            name.endsWith("/..")) {
        return true;
    }
    return false;
}
class TestDirTraversalTest : public QObject
{
    Q_OBJECT
        private slots:
        void test()
        {
            QFETCH(QString, string);
            QFETCH(bool, result);

            QCOMPARE(check(string), result);
        }

        void test_data()
        {
            QTest::addColumn<QString>("string");
            QTest::addColumn<bool>("result");

            QTest::newRow("traversal up relative to root") << "/../foo/bla" << true;
            QTest::newRow("traversal up at beginning") << "../foo/bla" << true;
            QTest::newRow("traversal up inside") << "bla/../foo/bla" << true;
            QTest::newRow("traversal up at end") << "foo/bla/.." << true;
            QTest::newRow("traversal down, contains path component") << "foo/bla" << true;
        }


};

QTEST_MAIN(TestDirTraversalTest)
#include "test.moc"
Comment 28 Ludwig Nussel 2010-10-06 13:08:00 UTC
foo/bla should be accepted as that just refers to a sub directory. You need to check whether the path contains "/../" or starts with "../" or ends in "/..". IOW split at '/' and check if any component is '..'.
Comment 29 Will Stephenson 2010-10-06 13:16:20 UTC
Shouldn't the 5th case be rejected as well?  

What if foo/bla is etc/resolv.conf and I save in /?
Comment 30 Ludwig Nussel 2010-10-06 13:22:21 UTC
If that works you run kget as root which means it's your own fault :-)
The same applies to your home though. To fix that you'd have to always use the basename of all files. That would potentially break certain torrents that contain multiple files though I guess. OTOH it's a case of don't do that. You shouldn't extract arbitrary zip files in your home either after all.
Comment 31 Ludwig Nussel 2010-10-06 13:23:27 UTC
eh, why did I think of torrents? no idea. Can metalink files actually contain multiple files?
Comment 32 Will Stephenson 2010-10-06 13:43:06 UTC
Yes, directory information may be contained in the name attribute; see 4.1.2.2 at http://metalinker.org/Metalink_3.0_Spec.pdf.
Comment 33 Dirk Mueller 2010-10-06 13:51:34 UTC
so reject it if .startswith("/")..
Comment 34 Sebastian Krahmer 2010-11-02 13:06:39 UTC
Have new patches been submitted so we can re-submit PIs?
Comment 35 Will Stephenson 2010-11-18 16:46:41 UTC
About to submit, these include fixes for non-security bugs as follows:

11.3: 653852
11.2: 653852
11.1: 653852, 525528, 516347
SLE11SP1: 635852, 516347
SLE11GA: 653852, 525528, 516347
Comment 36 Swamp Workflow Management 2010-11-19 09:04:07 UTC
The SWAMPID for this issue is 37285.
This issue was rated as moderate.
Please submit fixed packages until 2010-12-03.
When done, please reassign the bug to security-team@suse.de.
Patchinfo will be handled by security team.
Comment 37 Andrej Semen 2010-12-14 14:11:08 UTC
could you write/tel how to use/run the test application from comment #25 and #27?
Comment 38 Andrej Semen 2010-12-14 16:49:05 UTC
did get info from Dirk
Comment 39 Swamp Workflow Management 2010-12-15 12:31:50 UTC
Update released for: kde4-kdnssd, kde4-kget, kde4-knewsticker, kde4-kopete, kde4-kopete-devel, kde4-kppp, kde4-krdc, kde4-krfb, kdenetwork4, kdenetwork4-debuginfo, kdenetwork4-debugsource, kdenetwork4-filesharing
Products:
SLE-DEBUGINFO 11 (i386, ia64, ppc64, s390x, x86_64)
SLE-DESKTOP 11 (i386, x86_64)
SLE-SDK 11 (i386, ia64, ppc64, s390x, x86_64)
SLE-SERVER 11 (i386, ia64, ppc64, s390x, x86_64)
Comment 40 Swamp Workflow Management 2010-12-17 10:12:22 UTC
Update released for: kdenetwork4, kdenetwork4-debugsource, kdenetwork4-filesharing, kdenetwork4-filesharing-debuginfo, kdnssd, kdnssd-debuginfo, kget, kget-debuginfo, kopete, kopete-debuginfo, kopete-devel, kppp, kppp-debuginfo, krdc, krdc-debuginfo, krfb, krfb-debuginfo
Products:
openSUSE 11.2 (debug, i586, x86_64)
openSUSE 11.3 (debug, i586, x86_64)
Comment 41 Swamp Workflow Management 2010-12-17 10:13:13 UTC
Update released for: kde4-kdnssd, kde4-kget, kde4-knewsticker, kde4-kopete, kde4-kopete-devel, kde4-kppp, kde4-krdc, kde4-krfb, kdenetwork4, kdenetwork4-debuginfo, kdenetwork4-debugsource, kdenetwork4-filesharing
Products:
openSUSE 11.1 (debug, i586, ppc, x86_64)
Comment 42 Swamp Workflow Management 2010-12-17 13:16:04 UTC
Update released for: kde4-kdnssd, kde4-kget, kde4-knewsticker, kde4-kopete, kde4-kopete-devel, kde4-kppp, kde4-krdc, kde4-krfb, kdenetwork4, kdenetwork4-debuginfo, kdenetwork4-debugsource, kdenetwork4-filesharing, kdnssd, kget, kopete, kopete-devel, kppp, krdc, krfb
Products:
SLE-DEBUGINFO 11-SP1 (i386, ia64, ppc64, s390x, x86_64)
SLE-DESKTOP 11-SP1 (i386, x86_64)
SLE-SDK 11-SP1 (i386, ia64, ppc64, s390x, x86_64)
SLE-SERVER 11-SP1 (i386, ia64, ppc64, s390x, x86_64)
SLES4VMWARE 11-SP1 (i386, x86_64)
Comment 43 Sebastian Krahmer 2011-01-04 12:55:20 UTC
updates released
Comment 44 Dirk Mueller 2011-05-13 19:09:15 UTC
*** Bug 687873 has been marked as a duplicate of this bug. ***
Comment 45 Bernhard Wiedemann 2016-04-15 11:44:12 UTC
This is an autogenerated message for OBS integration:
This bug (604709) was mentioned in
https://build.opensuse.org/request/show/39843 11.1 / kdenetwork4
https://build.opensuse.org/request/show/39847 11.2 / kdenetwork4
https://build.opensuse.org/request/show/40210 Factory / kdenetwork4
https://build.opensuse.org/request/show/53355 11.1:Test / kdenetwork4
https://build.opensuse.org/request/show/53356 11.2:Test / kdenetwork4
https://build.opensuse.org/request/show/53357 11.3:Test / kdenetwork4
Comment 46 Swamp Workflow Management 2018-07-31 08:41:24 UTC
This is an autogenerated message for OBS integration:
This bug (604709) was mentioned in
https://build.opensuse.org/request/show/626656 15.0 / kopete