Symlink traversal in debian/copyright storing code

Bug #532454 reported by William Grant
258
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Julian Edwards

Bug Description

From lp.archiveuploader.dscfile:

        globpath = os.path.join(tmpdir, "*", "debian/copyright")
        for fullpath in glob.glob(globpath):
            if not os.path.exists(fullpath):
                continue
            self.logger.debug("Copying copyright contents.")
            self.copyright = open(fullpath).read().strip()

Yeah, that's probably not such a good idea. If debian/copyright is a symlink, the upload processor will still dutifully read it in and store it in the database. The malicious uploader could do something like symlink to /dev/zero, causing memory exhaustion. Or they could symlink to some other file, submit a branch to get SPR.copyright exposed on the API, and get the contents of any readable file.

SPR.copyright fortunately isn't exposed anywhere yet AFAICT, so it's probably at worst a DoS.

Revision history for this message
William Grant (wgrant) wrote :
Revision history for this message
William Grant (wgrant) wrote :
Revision history for this message
William Grant (wgrant) wrote :
Revision history for this message
William Grant (wgrant) wrote :

This one will stick /etc/passwd into the new SPR's copyright column.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

<wgrant> ... probably just needs to check if debian/changelog is a symlink and reject it.

Changed in soyuz:
status: New → Confirmed
importance: Undecided → High
status: Confirmed → Triaged
Changed in soyuz:
status: Triaged → In Progress
assignee: nobody → Julian Edwards (julian-edwards)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

landed on production-devel r9081

tags: added: soyuz-upload
Revision history for this message
Ursula Junque (ursinha) wrote : Bug fixed by a commit
Changed in soyuz:
milestone: none → 10.03
status: In Progress → Fix Committed
tags: added: qa-needstesting
Changed in soyuz:
status: Fix Committed → Fix Released
visibility: private → public
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.