ncmpcpp (version < 0. 5.4) can cause unexpected deletion of files

Bug #663925 reported by C de-Avillez
270
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ncmpcpp (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned
Natty
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: ncmpcpp

From an email to the Ubuntu bugSquad:

Dear Madam/Sir,

I am using Ubuntu 10.04 and I installed program ncmpcpp 0.4.1. from Ubuntu
repositories. There's bug described on the page http://unkart.ovh.org/ncmpcpp/:

ATTENTION: Feature, that allows you to physically remove directories from your
disk while being in browser is BROKEN IN ALL VERSIONS < 0.5.4 and may, under
some random circumstances, cause UNWANTED DELETION OF OTHER FILES. It needs to
be manually enabled in configuration file though, so if you don't use it, you're
fine. Otherwise you should upgrade to 0.5.4 or higher version immediately.

I used the feature, that can cause UNWANTED DELETION OF OTHER FILES. (I read
the ATTENTION notice too late.)

It removed about 1/2 of my HOME folder!!!!!

I would like to ask you, if you can remove this program from all
repositories, where it is included or fix the bug or use another version.

Yours sincerely

Natty already has ncmpcpp version 0.5.4-1, which is not affected.

All versions packaged for Ubuntu:

   ncmpcpp | 0.3.4-1 | karmic/universe | source, amd64, i386
   ncmpcpp | 0.4.1-1 | lucid/universe | source, amd64, i386
   ncmpcpp | 0.5.2-1 | maverick/universe | source, amd64, i386
   ncmpcpp | 0.5.4-1 | natty/universe | source, amd64, i386

TESTCASE:
/!\ ***WARNING*** This test case is destructive /!\

0. Install mpd and add music files into the music directory and verify that the user running ncmpcpp has write privileges on this directory. Configure ncmpcpp to point to this directory and allow files and directory deletion.
1. Start mpd
2. Start ncmpcpp
3. Switch to brower mode
4. Select the directory
5. Press the 'Del' key to delete the directory
=> Verify that some /random/ directory/files are deleted and that the deletion of the selected directory fails. Repeat until it deletes unselected files/directories
6. Install the version from -proposed
7. Repeat steps 2 to 5 and verify that only the selected directory is deleted.

Related branches

C de-Avillez (hggdh2)
visibility: private → public
Revision history for this message
Alessandro Aragione (layn) wrote :

More than a bug I think it's human error as specified in the notice of the package the risk of any unexpected deletion of files. Nevertheless, I think is actually not necessary keep packages harmful to the system in the repository, or possibly eliminate the risk reported by the package itself. In the meantime, please upgrade to the next version of the file for a possible reorganization of the file in Home.

Changed in ncmpcpp (Ubuntu):
status: New → In Progress
status: In Progress → Opinion
Revision history for this message
C de-Avillez (hggdh2) wrote :

I disagree:
(1) the fact that this configuration option is not set on install does not mean it will not be set later on. It is an user's choice.
(2) if the configuration option is set there is a real risk of unexpected data loss.
(3) there are no newer versions available on Ubuntu (except for Natty, which is not really something we want casual users to run right now).

Changed in ncmpcpp (Ubuntu):
status: Opinion → New
Revision history for this message
Brian Murray (brian-murray) wrote :

Additionally, the web page seems to indicate that:

" It needs to be manually enabled in configuration file though, so if you don't use it, you're fine."

Revision history for this message
Marcel Stimberg (marcelstimberg) wrote :

I have no idea why it is questioned whether this is a valid a bug or not...‽ The webpage clearly confirms the bug, users do not get any warning that they shouldn't set the option allow_physical_directory_deletion to yes (we can't expect users to go to the project's webpage after installing a package) and the bug "has a severe impact on a small portion of Ubuntu users" (i.e. fulfilling the criteria for importance "High").

Revision history for this message
C de-Avillez (hggdh2) wrote :

Allowing for physical dir removal was introduced on 0.3.5, so Karmic and earlier releases are OK., and Lucid/Maverick are the only releases affected.

Revision history for this message
C de-Avillez (hggdh2) wrote :

here's a simple change to disable the option.

Revision history for this message
Alessandro Aragione (layn) wrote :

At this point I can not help but agree with C de-Avillez and consider the matter closed. I thank you all for your kind interest. I await any purpose other opinions in question

Revision history for this message
Alessandro Aragione (layn) wrote :

Thank you for taking the time to make Ubuntu better. Since what you submitted is a Feature Request to improve Ubuntu, you are invited to post your idea in Ubuntu Brainstorm at [WWW] https://brainstorm.ubuntu.com/ where it can be discussed, voted by the community and reviewed by developers. Thanks for taking the time to share your opinion!

Changed in ncmpcpp (Ubuntu):
status: New → Confirmed
Revision history for this message
C de-Avillez (hggdh2) wrote :

This is a simple patch: I decided to disable 'allow_physical_directory_deletion' if it is set, and output an error message (which will be routed to the error.log file) *if* the current configuration file has 'allow_physical_directory_deletion = "yes"'.

This is minimally invasive, and I confirmed the option is reset if present in ~/.ncmpcpp/config.

I am still to look at the Lucid version.

Changed in ncmpcpp (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Artur Rona (ari-tczew) wrote :

Thanks for the patch. You have to fix some issues, following with https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation.

debian/changelog: - s/maverick/maverick-security
                              - please remove information about updated maintainer field. it's not necessary.

debian/patches/disable-dir-removal.patch: there are not DEP3 tags. Please complete it following with https://wiki.ubuntu.com/UbuntuDevelopment/PatchTaggingGuidelines.

Please resubscribe sponsors when patch is ready.

tags: added: patch
Revision history for this message
C de-Avillez (hggdh2) wrote :

Updated patch attached.

This fix does not apply to Debian: rmadison lists only 0.5.4 on squeeze and sid.

Artur Rona (ari-tczew)
Changed in ncmpcpp (Ubuntu):
assignee: nobody → Artur Rona (ari-tczew)
status: Triaged → In Progress
Revision history for this message
C de-Avillez (hggdh2) wrote :

And here is the debdiff for Lucid.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Artur helped me on -motu, and pointed some more issues on the patches. I am uploading new versions for both Lucid and Maverick.

For the record, and as a consolidation of the data on this bug:

This bug has never been reported to Mitre; as such, there is no CVE associated with it. The security exposure here is arbitrary data loss, caused by mishandling a directory removal. This was announced on the developer's site, with the text:

"ATTENTION: Feature, that allows you to physically remove directories from your disk while being in browser is BROKEN IN ALL VERSIONS < 0.5.4 and may, under some random circumstances, cause UNWANTED DELETION OF OTHER FILES. It needs to be manually enabled in configuration file though, so if you don't use it, you're fine. Otherwise you should upgrade to 0.5.4 or higher version immediately.".

A quick look on the upstream GIT (http://repo.or.cz/w/ncmpcpp.git) does not clearly show a patch for this issue.

I am uploading two debdiff's:

Lucid-security: ncmpcpp_0.4.1-1ubuntu0.1.debdiff
Maverick-security: ncmpcpp_0.5.2-1ubuntu0.1.debdiff

The patch itself is minimally intrusive, and just disables the option after startup (and after the configuration file -- if any -- has been read and processed. This is the single point where the configuration file is read and acted on; after that, we print an error message to error.log (stderr redirected), and proceed as usual.

I have tested the patches.

Revision history for this message
C de-Avillez (hggdh2) wrote :

This is probably the fix in GIT upstream for this issue: http://repo.or.cz/w/ncmpcpp.git/commit/d1b82557d266795621244c62644d4d0604cf5453

I do not know if this is the single patch needed or not.

Revision history for this message
Artur Rona (ari-tczew) wrote :

ncmpcpp (0.5.4-1) unstable; urgency=high

  * New upstream release.
    + Set urgency to high because it fixes a potential deletion of directories.
  * Update copyright file.
  * debian/patches/charset-use-free-to-release-memory.patch
    + Remove patch since it is fixed in new release.
  * Switch to dpkg-source 3.0 (quilt).
    + Get rid of Build-Depends on quilt.
    + Remove include of CDBS quilt file.
 -- Ubuntu Archive Auto-Sync <email address hidden> Fri, 15 Oct 2010 09:47:44 +0000

Changed in ncmpcpp (Ubuntu):
assignee: Artur Rona (ari-tczew) → nobody
status: In Progress → Fix Released
Revision history for this message
C de-Avillez (hggdh2) wrote :

OK, I finally had time to get back to it. I am attaching a new debdiff for Maverick, now with the upstream patch for this issue. Indeed, at least for Maverick, the patch I identified on comment 15 above is all that is needed.

Tested on Maverick. I will look at Lucid now.

Revision history for this message
Artur Rona (ari-tczew) wrote :

MOTU-SWAT ACK.

Some concerns:
- There is Origin tag, so Applied-Upstream is not necessary.
- I'm not sure whether this is security issue, for me rather a SRU.

Are you going to prepare a patch for lucid?

Changed in ncmpcpp (Ubuntu Maverick):
status: New → Confirmed
Revision history for this message
Steve Beattie (sbeattie) wrote :

I concur with Artur's second concern; while this is a serious issue with this package, I don't believe it's a security issue, as I don't see a means for an attacker to cause the deletion to occur, though I haven't examined what the actual code issue is specifically. It seems to me that the SRU process is more appropriate route for a fix for this issue. I'm unsubscribing ubuntu-security-sponsers on this basis; please resubscribe if there's an indetifiable route for an outside third party to cause the deletion to occur.

Revision history for this message
Artur Rona (ari-tczew) wrote :

OK I'll sponsor patch for maverick.We are waiting for debdiff for lucid ;)

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted ncmpcpp into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in ncmpcpp (Ubuntu Maverick):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
C de-Avillez (hggdh2) wrote :

Sorry for the delay. I rebased the upstream patch (there was a small difference on functionality added on a post-0.4.1 level), and checked.

Changed in ncmpcpp (Ubuntu Lucid):
status: New → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted ncmpcpp into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in ncmpcpp (Ubuntu Lucid):
status: Triaged → Fix Committed
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

SRU verification for Lucid:
I have reproduced the problem with ncmpcpp 0.4.1-1 in lucid and have verified that the version of ncmpcpp 0.4.1-1ubuntu0.1 in -proposed fixes the issue.

Marking as verification-done

tags: added: verification-done-lucid
description: updated
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

SRU verification for Maverick:
I have reproduced the problem with ncmpcpp 0.5.2-1 in maverick and have verified that the version of ncmpcpp 0.5.2-1ubuntu0.1 in -proposed fixes the issue.

Marking as verification-done

tags: added: verification-done
removed: verification-done-lucid verification-needed
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ncmpcpp - 0.4.1-1ubuntu0.1

---------------
ncmpcpp (0.4.1-1ubuntu0.1) lucid-proposed; urgency=low

  * debian/patches/incorrect-dir-removal.patch: cherry-pick upstream fix to
    arbitrary directories removal. This patch is for Lucid only -- had to be
    rebased due to a small difference in code. Already corrected on newer
    0.5.4 onwards. (LP: #663925)
 -- C de-Avillez <email address hidden> Sat, 19 Feb 2011 14:00:57 -0600

Changed in ncmpcpp (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ncmpcpp - 0.5.2-1ubuntu0.1

---------------
ncmpcpp (0.5.2-1ubuntu0.1) maverick-proposed; urgency=low

   * debian/patches/incorrect-dir-removal.patch: cherry-pick upstream fix to
     arbitrary directories removal. This patch is for Lucid and Maverick
     only, already corrected on newer 0.5.4 onwards. (LP: #663925)
 -- C de-Avillez <email address hidden> Wed, 20 Oct 2010 15:25:32 -0500

Changed in ncmpcpp (Ubuntu Maverick):
status: Fix Committed → Fix Released
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.