SEC Consult SA-20170509-0 :: Multiple vulnerabilities in I, Librarian PDF manager

--------------ms070202060502000701070006
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

SEC Consult Vulnerability Lab Security Advisory < 20170509-0 >
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
              title: Multiple vulnerabilities
            product: I, Librarian PDF manager
 vulnerable version: <=3D4.6 & 4.7
      fixed version: 4.8
         CVE number: -
             impact: Critical
           homepage: https://i-librarian.net/
              found: 2017-01-30
                 by: Wan Ikram (Office Kuala Lumpur)
                     Fikri Fadzil (Office Kuala Lumpur)
                     Jasveer Singh (Office Kuala Lumpur)
                     SEC Consult Vulnerability Lab

                     An integrated part of SEC Consult
                     Bangkok - Berlin - Linz - Luxembourg - Montreal - Mo=
scow
                     Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Z=
urich

                     https://www.sec-consult.com

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Vendor description:
-------------------
"I, Librarian is a PDF manager or PDF organizer, which enables researcher=
s,
scholars, or students to create an annotated collection of PDF articles. =
If
used as a groupware, users may build their virtual library collaborativel=
y,
sharing the workload of literature mining. I, Librarian will make your wo=
rk
with scientific literature incredibly efficient."

Source: https://i-librarian.net/


Business recommendation:
------------------------
By combining the vulnerabilities documented in this advisory an attacker =
can
fully compromise the web server which has the "I, Librarian" software ins=
talled.

SEC Consult recommends to install the latest version available immediatel=
y and
perform a thorough security review of this software.


Vulnerability overview/description:
-----------------------------------
The application doesnt apply proper validation on some user inputs. As a=

result, below vulnerabilities can be exploited by authenticated attackers=
 with
any roles to fully compromise the system.

1. OS Command Injection
Arbitrary OS commands are possible to be executed from "batchimport.php".=
 This
is a serious vulnerability as the chances for the web server to be fully
compromised are very high.

2. Server-Side Request Forgery
This vulnerability allows an attacker to send HTTP requests originating f=
rom the
web server. As some functions in the web application require requests to
be done from localhost, the risk for this vulnerability is considered hig=
h.

3. Directory Enumeration
It is possible to enumerate all directories in any directory on the serve=
r through
"jqueryFileTree.php".

4. Reflected Cross Site Scripting
This vulnerability was found in "temp.php". It allows an attacker to inje=
ct
malicious client side scripting which will be executed in the browser of =
users
if they visit the manipulated site.


Proof of concept:
-----------------
1. OS Command Injection
Below is the detail of a HTTP request that needs to be sent to execute ar=
bitrary
OS commands through "batchimport.php":

URL     : http://$DOMAIN/batchimport.php
METHOD  : GET
PAYLOAD : directory=3D.&commence=3D&user=3D"||<os-commands-here>||"


2. Server-Side Request Forgery
Below shows an example of the exploitation for this vulnerability. An att=
acker
can reset any users password which by design requires the request to be =
sent
from localhost.

URL     : http://$DOMAIN/ajaxsupplement.php
METHOD  : POST
PAYLOAD :
form_new_file_link=3Dhttp://$DOMAIN/resetpassword.php?username=3D<usernam=
e>&new_password1=3D<new-password>&new_password2=3D<new-password>


3. Directory Enumeration
Available directories can be enumerated simply by navigating through the =
"dir"
parameter in "jqueryFileTree.php".

URL     : http://$DOMAIN/jqueryFileTree.php
METHOD  : POST
PAYLOAD : dir=3D<path-to-directory>


4. Reflected Cross Site Scripting
The following payload shows a simple alert message box:
URL     : http://$DOMAIN/temp.php
METHOD  : GET
PAYLOAD : tempfile=3D<script>alert(42)</script>


Vulnerable / tested versions:
-----------------------------
"I, Librarian" version 4.6 has been tested. This version was the latest
at the time the security vulnerabilities were discovered. It is assumed
that previous versions are affected as well.


Vendor contact timeline:
------------------------
2017-01-31: Contacting vendor through support@i-librarian.net
2017-01-31: Vendor replied with their PGP public key.
2017-02-03: Provided encrypted advisory and proof of concept to the vendo=
r.
2017-02-09: Patch released, version 4.7.
2017-02-21: Informed vendor on some issues which were not addressed corre=
ctly.
2017-03-30: Patch released by the vendor - I, Librarian version 4.8.
2017-05-09: Public release of advisory


Solution:
---------
Upgrade to I, Librarian 4.8

For further information see:
https://i-librarian.net/article.php?id=3D9


Workaround:
-----------
None


Advisory URL:
-------------
https://www.sec-consult.com/en/Vulnerability-Lab/Advisories.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEC Consult Vulnerability Lab

SEC Consult
Bangkok - Berlin - Linz - Luxembourg - Montreal - Moscow
Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Zurich

About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult. I=
t
ensures the continued knowledge gain of SEC Consult in the field of netwo=
rk
and application security to stay ahead of the attacker. The SEC Consult
Vulnerability Lab supports high-quality penetration testing and the evalu=
ation
of new offensive and defensive technologies for our customers. Hence our
customers obtain the most current information about vulnerabilities and v=
alid
recommendation about the risk profile of new technologies.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?
Send us your application https://www.sec-consult.com/en/Career.htm

Interested in improving your cyber security with the experts of SEC Consu=
lt?
Contact our local offices https://www.sec-consult.com/en/About/Contact.ht=
m
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mail: research at sec-consult dot com
Web: https://www.sec-consult.com
Blog: http://blog.sec-consult.com
Twitter: https://twitter.com/sec_consult

EOF Jasveer Singh / @2017


--------------ms070202060502000701070006
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC
CxgwggSvMIIDl6ADAgECAhEA4CPLFRKDU4mtYW56VGdrITANBgkqhkiG9w0BAQsFADBvMQsw
CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4
dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
MB4XDTE0MTIyMjAwMDAwMFoXDTIwMDUzMDEwNDgzOFowgZsxCzAJBgNVBAYTAkdCMRswGQYD
VQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNP
TU9ETyBDQSBMaW1pdGVkMUEwPwYDVQQDEzhDT01PRE8gU0hBLTI1NiBDbGllbnQgQXV0aGVu
dGljYXRpb24gYW5kIFNlY3VyZSBFbWFpbCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAImxDdp6UxlOcFIdvFamBia3uEngludRq/HwWhNJFaO0jBtgvHpRQqd5jKQi3xdh
TpHVdiMKFNNKAn+2HQmAbqUEPdm6uxb+oYepLkNSQxZ8rzJQyKZPWukI2M+TJZx7iOgwZOak
+FaA/SokFDMXmaxE5WmLo0YGS8Iz1OlAnwawsayTQLm1CJM6nCpToxDbPSBhPFUDjtlOdiUC
ISn6o3xxdk/u4V+B6ftUgNvDezVSt4TeIj0sMC0xf1m9UjewM2ktQ+v61qXxl3dnUYzZ7ifr
vKUHOHaMpKk4/9+M9QOsSb7K93OZOg8yq5yVOhM9DkY6V3RhUL7GQD/L5OKfoiECAwEAAaOC
ARcwggETMB8GA1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