[Vulnerability] --- Firebase "+firebaseURL+" is publicly accessible
" ) 42 | writeResults(filename,"[Vulnerability] --- Misconfigured network_security_config.xml. \n Found "+searchObj.group()+" in network_security_config.xml which leads to MITM in Android devices API24 or above.Found <certificates src=\"user\" /> in network_security_config.xml
network_security_config.xml file Location:"+ stringsFile) 68 | else: 69 | writePassResults(filename,"[Info] --- Not found <certificates src=\"user\" /> in network_security_config.xml network_security_config.xml file Location:"+ stringsFile) 70 | # Search for[Vulnerability] --- Misconfigured network_security_config.xml. \n Found "+searchObj.group()+" in network_security_config.xml which leads to MITM in Android devices API24 or above.Found <certificates src=\"@raw/*\"/> in network_security_config.xml
network_security_config.xml file Location:"+ stringsFile) 75 | else: 76 | writePassResults(filename,"[Info] --- Not found <certificates src=\"@raw/*\"/> in network_security_config.xmlnetwork_security_config.xml file Location:"+ stringsFile) 77 | # Search for ClearTextTraffic 78 | searchObj=re.search(r'[Vulnerability] --- Misconfigured network_security_config.xml. \n Found "+searchObj.group()+" in network_security_config.xml which leads to MITM in Android devices API24 or above
network_security_config.xml file Location:"+ stringsFile) 82 | else: 83 | writePassResults(filename,"[Info] --- Not found <domain-config cleartextTrafficPermitted=\"true\"> in network_security_config.xmlnetwork_security_config.xml file Location:"+ stringsFile) 84 | except IOError: 85 | print("[Info] - App doesn't have network_security_config.xml"); 86 | writePassResults(filename,"App doesn't have network_security_config.xml") 87 | 88 | def getDeepLinks(): 89 | print("[Info] - Checking for Deeplinks"); 90 | writePassResults(filename," Custom URL Check") 91 | # for AndroidManifest.xml file 92 | f1=pwd+"\\"+filename+"\\"+manifestFile 93 | writePassResults(filename,"[Info]---AndroidManifest.xml file Location: "+ f1) 94 | with open(f1, errors='ignore') as f: 95 | f2=f.read() 96 | i= f2.count(" 0: 101 | j=j-1 102 | scheme1=re.search(r'android:scheme="(.*)"', searchObj1[j], re.M|re.I) 103 | if scheme1: 104 | print(" - scheme: "+ scheme1.group(1) ); 105 | writePassResults(filename,"scheme: "+ scheme1.group(1)) 106 | host1=searchObj1[j].replace(scheme1.group(),"") 107 | host2=re.search(r'"(.*)"', host1, re.M | re.I) 108 | if host2: 109 | print(" - host: " + host2.group(1)+"\n - Deeplink: " + scheme1.group(1) + "://"+ host2.group(1)); 110 | writePassResults(filename,"host: " + host2.group(1)+"Deeplink: " + scheme1.group(1) + "://"+ host2.group(1)) 111 | else: 112 | print(" - host: Not Found \n - Deeplink: " + scheme1.group(1) + "://"); 113 | writePassResults(filename,"No host foundDeeplink: "+ scheme1.group(1) + "://") 114 | else: 115 | host3=searchObj1[j].replace('"','') 116 | host4=host3.replace('/>','') 117 | writePassResults(filename,"no scheme foundhost: " + host4 +"Deeplink: " + "://" + host4) 118 | else: 119 | writePassResults(filename,"NO host") 120 | searchObj=re.findall(r' 0: 124 | i=i-1 125 | host=re.search(r'android:host="(.*)"' , searchObj[i], re.M|re.I) 126 | if host: 127 | writePassResults(filename,"host: " + host.group(1)) 128 | scheme1=searchObj[i].replace(host.group(),"") 129 | scheme=re.search(r'"(.*)"' , scheme1, re.M|re.I) 130 | if scheme: 131 | writePassResults(filename,"scheme: " + scheme.group(1)+"Deeplink: " + scheme.group(1)+"://"+host.group(1)) 132 | scheme=scheme1.replace(scheme.group(),"") 133 | else: 134 | writePassResults(filename,"No Scheme foundDeeplink: "+ "://"+ host.group(1)) 135 | else: 136 | scheme=searchObj[i].replace('"','') 137 | scheme=scheme.replace('/>','') 138 | writePassResults(filename,"no host foundscheme: " + scheme +"Deeplink: " + scheme + "://") 139 | else: 140 | writePassResults(filename,"No more schemes") 141 | 142 | def isDebuggableOrBackup(): 143 | f1=pwd+"\\"+filename+"\\"+manifestFile 144 | with open(f1, errors='ignore') as f: 145 | f2=f.read() 146 | print("[Info] - Checking AndroidManifest.xml"); 147 | searchObj=re.search(r'android:debuggable="true"' , f2, re.M|re.I) 148 | if searchObj: 149 | print(fg.red+"[Vuln] - Android debuggable. Found android:debuggable=true in AndroidManifest.xml file"+fg.rs); 150 | writeResults(filename,"[Vulnerability] ---Android debuggable. \n Found android:debuggable=true in AndroidManifest.xml file
") 151 | else: 152 | writePassResults(filename,"android:debuggable Check[Vulnerability] --- Android backup vulnerability. \n Found android:allowBackup=true in AndroidManifest.xml file
") 158 | elif searchObj2: 159 | writePassResults(filename,"android:allowBackup Check [Info] --- android:allowBackup=\"false\" found") 160 | else: 161 | print(fg.red+"[Vuln] - Android backup vulnerability. Not found android:allowbackup=true, default value is true, in AndroidManifest.xml file"+fg.rs); 162 | writeResults(filename,"[Vulnerability] --- Android backup vulnerability . \n Not found android:allowbackup=true, default value is true, in AndroidManifest.xml file
") 163 | 164 | def writeResults(filename,msg): 165 | f=open(resultsHtml,"a") 166 | f.write(msg) 167 | f.close() 168 | 169 | def writePassResults(filename,msg): 170 | f=open(resultsHtmlTemp,"a") 171 | f.write(msg) 172 | f.close() 173 | 174 | apkfile = sys.argv[-1] 175 | # Get file extension .apk 176 | filename, file_extension = os.path.splitext(apkfile) 177 | pwd=os.getcwd() 178 | stringsFile="\\res\\values\\strings.xml" 179 | nscFile="\\res\\xml\\network_security_config.xml" 180 | manifestFile="AndroidManifest.xml" 181 | resultsHtml=filename+".html" 182 | resultsHtmlTemp=filename+"Temp.html" 183 | head=" " 184 | endhtml=" " 185 | print(" ______ _______ _ _ _ _ _ _______ _"); 186 | print(" / _____) (_______) | | (_) | (_) (_|_______|_) "); 187 | print(" ( (____ ____ _____ ____ _______ ____ __| | ____ ___ _ __| | ___ _ _ _ _ "); 188 | print(" \____ \ / ___|____ | _ \| ___ | _ \ / _ |/ ___) _ \| |/ _ | | | | ||_|| | | "); 189 | print(" _____) | (___/ ___ | | | | | | | | | ( (_| | | | |_| | ( (_| |/ / \ \| | | | |_____ "); 190 | print(" (______/ \____)_____|_| |_|_| |_|_| |_|\____|_| \___/|_|\____|_| |_|_| |_|_______)"); 191 | print("\n Created by https://twitter.com/satish_patnayak\n"); 192 | print("This tool analyzes Android app to find vulnerabilities in \n1. AndroidManifest.xml \n2. network_security_config.xml \n3. Firebase URLs from strings.xml. \nThis tool also shows Deeplinks used in Android app.\n"); 193 | writeResults(filename, head +"