agent-security-hardening
AFaffaan-m/ECC314k3,503 new stars in the last 7 days
Android APK static analysis — OWASP Mobile Top 10, Retrofit API audit, transport security, smali reading, component export, auth flow analysis. Use when target is an APK/Android app. Triggers - APK, Android, mobile app, decompiled, smali, jadx, apktool.
Load this skill when the target is an Android APK (decompiled or not). This covers SAST — for dynamic testing (Frida, MITM), combine with playbook-webapp.
An APK audit is NOT one grep job. Decompose into these independent tasks (run in parallel):
.method public someMethod(Ljava/lang/String;)V # method signature
invoke-virtual {v0}, Lcom/example/Foo;->bar()V # method call
const-string v1, "hardcoded_value" # string constant
sget-object v0, Lcom/example/Config;->API_KEY:Ljava/lang/String; # static field
# @GET("endpoint") — HTTP method + path
.annotation runtime Lretrofit2/http/GET;
value = "auth/password"
.end annotation
# @Query("password") — parameter goes in URL query string!
.annotation runtime Lretrofit2/http/Query;
value = "password"
.end annotation
# @QueryMap — ALL params go in URL query string!
.annotation runtime Lretrofit2/http/QueryMap;
.end annotation
# @Body — parameter goes in request body (SAFE)
.annotation runtime Lretrofit2/http/Body;
.end annotation
# @Field — parameter goes in form body (SAFE)
.annotation runtime Lretrofit2/http/Field;
value = "password"
.end annotation
# @Header — parameter sent as HTTP header
.annotation runtime Lretrofit2/http/Header;
value = "Authorization"
.end annotation
CRITICAL CHECK: Any @Query/@QueryMap on a POST/PUT that carries sensitive data (password, PIN, OTP, token) = CRITICAL finding. Sensitive data in URL is logged everywhere (server access logs, proxies, CDNs, browser history, HTTP interceptors).
@POST("auth/password")
Call<AuthResponse> login(@QueryMap Map<String, String> params);
// ^ This means login credentials go in URL query string = CRITICAL
grant-uri-permissions or no read/write permissionandroid:debuggable="true" in manifestandroid:allowBackup="true" (data extractable via ADB)android:usesCleartextTraffic="true"grep -r 'exported="true"' resources/AndroidManifest.xml
grep -r 'android:debuggable' resources/AndroidManifest.xml
grep -r 'allowBackup' resources/AndroidManifest.xml
# SharedPreferences usage
grep -rn "SharedPreferences\|getSharedPreferences\|PreferenceManager" sources/
# Logging sensitive data
grep -rn "Log\.\(d\|i\|v\|w\|e\)" sources/ | grep -i "token\|password\|secret\|key\|auth"
# External storage
grep -rn "getExternalStorage\|EXTERNAL_STORAGE\|Environment.getExternalStorageDirectory" sources/
<pin-set> elementscleartextTrafficPermitted should be falsesetMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)# Certificate pinning
grep -r "pin-set\|CertificatePinner\|sha256/" resources/ sources/
# Trust all certs
grep -rn "X509TrustManager\|checkServerTrusted\|TrustAllCerts\|ALLOW_ALL" sources/
# Hostname verifier bypass
grep -rn "HostnameVerifier\|ALLOW_ALL_HOSTNAME_VERIFIER\|verify.*return true" sources/
@Query/@QueryMap on auth endpoints)# Find all API interface files (Retrofit)
find sources/ -name "*Api*" -o -name "*Service*" -o -name "*Endpoint*" | grep -i "\.java$\|\.smali$"
# Query params on auth
grep -A5 "@Query\|@QueryMap" sources/ | grep -B2 -i "password\|pin\|otp\|sms\|token\|secret"
grep -rn "AES/ECB\|DES\|RC4\|Cipher.getInstance" sources/
grep -rn "MessageDigest.getInstance.*MD5\|MessageDigest.getInstance.*SHA-1" sources/
grep -rn "SecretKeySpec\|IvParameterSpec" sources/ | grep -i "hardcoded\|static\|final"
# Find operations that use simple IDs
grep -rn '@Query("id")\|@Path("id")' sources/
# Debug tools in production
grep -rn "setWebContentsDebuggingEnabled\|ChuckerInterceptor\|Stetho\|LeakCanary\|Flipper" sources/
# Dev/staging URLs
grep -rn "staging\|\.dev/\|localhost\|10\.0\.\|192\.168\.\|debug" sources/ resources/
su, Superuser.apk)# Root detection
grep -rn "RootBeer\|isRooted\|/system/app/Superuser\|/system/xbin/su\|test-keys" sources/
# Frida detection
grep -rn "frida\|xposed\|substrate\|Magisk" sources/
# Emulator detection
grep -rn "generic\|goldfish\|sdk_gphone\|emulator\|genymotion\|bluestacks" sources/
Read the DI component files to find what's wired into the app:
# Find DI modules
find sources/ -name "*Module*" -o -name "*Component*" | grep -i "dagger\|hilt\|di\|inject"
# Look for interceptors in OkHttp chain
grep -rn "Interceptor\|addInterceptor\|addNetworkInterceptor" sources/
Chucker/Stetho/Flipper interceptors in the OkHttp chain = HIGH (logs all HTTP traffic).
# Full network security config
cat resources/res/xml/network_security_config.xml
# Check for domain-config entries (dev/staging domains?)
grep -r "domain-config\|includeSubdomains\|cleartextTrafficPermitted" resources/
Map each permission to its justification. Flag excessive:
READ_CONTACTS / READ_CALL_LOG — legitimate for banking?QUERY_ALL_PACKAGES — anti-emulator, but privacy concernRECORD_AUDIO — voice banking or unnecessary?ACCESS_FINE_LOCATION — branch locator or tracking?Read ALL Retrofit API interface files and build a complete endpoint map:
# Find all API interfaces
find sources/ -name "*Api*" | grep -v "test\|mock\|fake"
# Extract HTTP methods and paths
grep -rn "@GET\|@POST\|@PUT\|@PATCH\|@DELETE\|@HTTP" sources/
For each endpoint, note:
@Query = URL, @Body = body, @Field = form)Endpoints to focus on: auth, transfers, payments, password management, profile changes.
These are NOT findings — downgrade to INFO or skip:
These BECOME findings only when:
/.json and storage URL)After individual checks, chain findings for combined impact:
For each finding, call state_update add_vuln with:
severity: use the chained impact, not individualevidence: exact file:line or smali path + the relevant code/annotationstatus: "confirmed" for code-level findings (they're deterministic, no FP risk)description: what it is + WHY it matters + what an attacker can doFor absence findings (no pinning, no root detection): still record as vuln — the absence IS the finding. Evidence = "searched for X in all sources/resources, not found."
AFaffaan-m/ECC314k3,503 new stars in the last 7 days
Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.
DIDietrichGebert/ponytail202k4,226 new stars in the last 7 days
GAgarrytan/gstack143k524 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills122k1,421 new stars in the last 7 days
ADaddyosmani/agent-skills122k1,421 new stars in the last 7 days
RUruvnet/RuView106k596 new stars in the last 7 days