Closed
Bug 1231307
Opened 10 years ago
Closed 10 years ago
Incorrect processing of blank lines in diffs can be used to hide changes from reviewers
Categories
(addons.mozilla.org Graveyard :: Administration, defect)
addons.mozilla.org Graveyard
Administration
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: jwkbugzilla, Unassigned)
Details
(4 keywords)
Attachments
(2 files)
AMO reviewers largely rely on the diff functionality when reviewing updates - rather than reviewing the entire extension code again they will look only at the changes. This approach relies on the diffs being displayed correctly. However, AMOs diff view doesn't treat blank lines correctly, with the result that one can hide a malicious update completely.
Steps to reproduce:
1. Upload attached test-1.0.xpi to AMO and get it reviewed.
2. Upload attached test-2.0.xpi as an update.
3. Open editor tools, click on "Malicious diff test" in the updates queue.
4. Click "Compare" to compare version 2.0 to 1.0 and switch to bootstrap.js.
Expected results:
The changes should be displayed correctly: twenty blank lines removed at the beginning of the file, function malicious() added towards the end of it.
Actual results:
The diff confusingly marks the lines immediately following the removed lines as removed as well. Instead of showing that function malicious() was added the diff marks a few lines as new which already existed in the previous version. Worse yet, the diff is cut off and doesn't show the last twenty lines of the file - including function malicious(). Any malicious code added is completely invisible to the reviewers.
| Reporter | ||
Comment 1•10 years ago
|
||
Updated•10 years ago
|
Flags: sec-bounty?
Comment 3•10 years ago
|
||
Andy is now in charge of AMO.
Flags: needinfo?(wclouser) → needinfo?(amckay)
| Assignee | ||
Updated•10 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
Updated•10 years ago
|
Component: Admin/Editor Tools → Add-on Security
Flags: needinfo?(amckay)
Product: addons.mozilla.org Graveyard → addons.mozilla.org
Updated•10 years ago
|
Keywords: wsec-applogic,
wsec-injection
Comment 4•10 years ago
|
||
Thanks for reporting Wladimir.
I spoke with :andym about this issue, he said that there are big changes likely to be coming from the reviewer team around policy.
I'm less concerned about this than I might otherwise be for this class of bug as a malicious actor could also obfuscate code beyond the ability of the reviewers to identify it, but would still like to see something done with a detective if not protective control.
Andy, is there a where we could add a check and alert for source files that begin with some number of blank lines? Then we could close it as resolved as opposed to wontfix.
Could we get this bug an owner?
Flags: needinfo?(amckay)
Updated•10 years ago
|
Flags: sec-bounty? → sec-bounty+
Keywords: sec-moderate
Updated•10 years ago
|
Flags: sec-bounty+ → sec-bounty?
Updated•10 years ago
|
Flags: sec-bounty? → sec-bounty+
Keywords: sec-moderate → sec-high
Comment 5•10 years ago
|
||
To-do:
Scan existing add-ons for source files with n=? blank lines at the top to make sure this has not been abused in the past.
| Reporter | ||
Comment 6•10 years ago
|
||
(In reply to Adam Muntner [:adamm] from comment #4)
> I'm less concerned about this than I might otherwise be for this class of
> bug as a malicious actor could also obfuscate code beyond the ability of the
> reviewers to identify it,
I don't think I agree (it's hard to obfuscate code without raising suspicions) but I don't care as long as this is fixed.
> Andy, is there a where we could add a check and alert for source files that
> begin with some number of blank lines?
I don't think that this bug is limited to blank lines at the beginning of the file, that's merely my proof of concept. While I can understand why nobody wants to touch the diff viewer, working around the issue without understanding it won't really help anybody...
Comment 7•10 years ago
|
||
Can I just check you can still reproduce this?
https://addons.allizom.org/en-US/firefox/files/compare/319504...319503/file/bootstrap.js#top
Seems to look good and the diff matches what the good old file system diff tells me. If that's the case, I'd be curious to know why. Lots of changes have been made recently with the upgrades to jquery and general cleaning.
Flags: needinfo?(amckay)
Updated•10 years ago
|
Component: Add-on Security → Administration
| Reporter | ||
Comment 8•10 years ago
|
||
Unfortunately, updating my AMO instance turned out complicated. I tried the Docker approach which didn't work either (https://github.com/mozilla/addons-server/issues/1745). So it might take a while until I can retest this...
| Reporter | ||
Comment 9•10 years ago
|
||
Managed to figure out my problems.
Yes, with the current AMO version this issue appears to be gone. Blank lines are handled correctly, both when added and removed.
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
| Assignee | ||
Updated•10 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
| Reporter | ||
Comment 10•10 years ago
|
||
I think that this should be made public by now.
Flags: needinfo?(amuntner)
Updated•10 years ago
|
Group: client-services-security
Flags: needinfo?(amuntner)
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•