ย ๐ How to Bypass Geo Restrictions in Android Apps and Games
๐ Background:
In Android apps and games, geo-related information is commonly retrieved via TelephonyManager methods such as:
โ getNetworkOperatorName() / getSimOperatorName() โ Operator/Carrier Name (e.g., โAT&Tโ)
โ getNetworkOperator() / getSimOperator() โ PLMN (MCC+MNC, e.g., โ310410โ)
โ getNetworkCountryIso() / getSimCountryIso() โ Country ISO code (e.g., โUSโ)
๐ TelephonyManager API:
https://developer.android.com/reference/android/telephony/TelephonyManager
At the smali level we can patch the code right after the invoke-virtual call and the move-result-object so that the register that received the string result is overwritten with a fixed string (dummy/fake values). Below are example regex searches and the replacement snippets to inject constant strings.
๐ ๏ธ Smali Patching Instructions
1๏ธโฃ Spoofing Carrier Name
๐ Search Pattern (Regex):
(invoke-virtuals{(?:[pv]d+)},sLandroid/telephony/TelephonyManager;->get(?:Network|Sim)OperatorName()Ljava/lang/String;n(?:s(?:[.#][^n])?n)smove-result-objects([pv]d+))(?:nnsconst-strings2,s".")?
โ๏ธ R eplace With:
$1nn
tconst-string $2, "AT&T"
This
overrides the result of getNetworkOperatorName() or getSimOperatorName() with a hardcoded carrier name.
2๏ธโฃ Spoofing PLMN (MCC+MNC)
๐ Search Pattern (Regex):
(invok
e-virtuals{(?:[pv]d+)},sLandroid/telephony/TelephonyManager;->get(?:Network|Sim)Operator()Ljava/lang/String;n(?:s(?:[.#][^n])?n)smove-result-objects([pv]d+))(?:nnsconst-strings2,s".")?
โ๏ธ Replace With:
$1nntcons
t-string $2, "310410"
This sets
the MCC+MNC code to โ310410โณ (AT&T USA).
3๏ธโฃ Spoofing Country ISO
๐ Search Pattern (Regex):
(invoke-virt
uals{(?:[pv]d+)},sLandroid/telephony/TelephonyManager;->get(?:Network|Sim)CountryIso()Ljava/lang/String;n(?:s(?:[.#][^n])?n)smove-result-objects([pv]d+))(?:nnsconst-strings2,s".")?
โ๏ธ Replace With: $1nntconst-stri
ng $2, "US"
This forces the
app to believe the device is located in the United States.
๐ง Why These Regex Patterns Are Powerful
These regexes are designed with advanced smali parsing in mind. Hereโs what makes them robust and reliable:
1. โ Comprehensive Matching: They capture all possible TelephonyManager calls, even if debug directives, annotations, or comments are present or absent.
2. ๐ Multi-line Resilience: Whether debug info appears single line or across multiple lines, the regex still matches accurately without breaking.
3. ๐ Safe Reapplication: You can apply these regexes repeatedly without stacking duplicate replacements or injecting dummy code fragments.
๐ Notes:
1. Because this modifies smali code (dex disassembly), it will not work if the app uses native code, runtime-decrypted strings, or has tamper-proofing/encryption/packing that prevents straightforward smali patching.
2. This technique changes only the returned string values at the smali level. It does not handle other checks the app may make (e.g., location APIs, server-side verification, or other device identifiers).
3. To obtain MCC+MNC codes, you can check out the following resources.
โ ๐ Website:
https://mcc-mnc.net โ A comprehensive database of Mobile Country Codes (MCC) and Mobile Network Codes (MNC).
โ ๐ฆ GitHub Repository:
https://github.com/P1sec/MCCMNC โ An open-source collection of MCC/MNC data maintained by the community.
โโโโโโโโโโโโโโโโโโโ
๐ฃ Main Channel: @TDOhex
๐ฑSecond Channel: @AndroidPatches
๐ฌ Discussion Group: @TDOhexDiscussion
โโโโโโโโโโโโโโโโโโโ
ย Washington Cuts Flow Of US Dollars To Iraqi Central Bank Until 'Acceptable' Government Formed Washington…
ย Washington Cuts Flow Of US Dollars To Iraqi Central Bank Until 'Acceptable' Government Formed Washington…
ย ๐ฑ๐ง๐ฎ๐ฑ What The Israeli Occupation is Doing in Southern Lebanon is no Longer a Passing…
ย โ๏ธHungaryโs Prime Minister-elect says ICC warrants, including Netanyahu war crimes case, would be enforced under…
ย โ ๐ฎ๐ฑ/๐ฑ๐ง/๐บ๐ณ NEW: The statue of Jesus Christ that was destroyed by an IDF soldier…
ย Dozens of Israelis detained at Moscow airport over war on Iran: Report Russian security forces…
This website uses cookies.