Skip to content

Commit 1eed552

Browse files
author
isayan
committed
First commit
0 parents  commit 1eed552

41 files changed

Lines changed: 901 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.iml
2+
.gradle
3+
local.properties
4+
/app//build

Readme-ja.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Android 14 の Root証明書インストールバイパス
2+
3+
## 概要
4+
5+
Android 14 では信頼されたRoot証明書へのインストールが困難になっている。
6+
7+
- https://httptoolkit.com/blog/android-14-breaks-system-certificate-installation/
8+
9+
本制限を回避するための方法を示す。
10+
11+
## 回避概要
12+
13+
証明書を読み込む処理にて、「/apex/com.android.conscrypt/cacerts」から読み込むようになっているがシステムプロパティが「system.certs.enabled」となっている場合は、以前の「/system/etc/security/cacerts/」より証明書を取得するコードになっている。
14+
15+
- https://android-review.googlesource.com/c/platform/prebuilts/fullsdk/sources/+/2704396/1/android-34/android/security/net/config/SystemCertificateSource.java
16+
17+
````java
18+
private static File getDirectory() {
19+
if ((System.getProperty("system.certs.enabled") != null)
20+
&& (System.getProperty("system.certs.enabled")).equals("true")) {
21+
return new File(System.getenv("ANDROID_ROOT") + "/etc/security/cacerts");
22+
}
23+
File updatable_dir = new File("/apex/com.android.conscrypt/cacerts");
24+
if (updatable_dir.exists()
25+
&& !(updatable_dir.list().length == 0)) {
26+
return updatable_dir;
27+
}
28+
return new File(System.getenv("ANDROID_ROOT") + "/etc/security/cacerts");
29+
}
30+
````
31+
32+
回避するために本挙動を利用します。
33+
34+
## 具体的な方法
35+
36+
「system.certs.enabled」のシステムプロパティを書き換える方法として、Android の XposedModule を作成することで行う。
37+
38+
39+
「OverrideSysPropModule」フォルダに作成した XposedModule をおいている。
40+
41+
## 手順 (Emulator)
42+
43+
エミュレータの場合、以下の手順でMagiskをインストールする。
44+
45+
+ https://github.com/newbit1/rootAVD より git cloneを行う
46+
47+
```
48+
git clone https://github.com/newbit1/rootAVD.git
49+
```
50+
+ エミュレータを起動
51+
+ 管理画面の PowerShell から以下のコマンドを実行
52+
53+
```
54+
.\rootAVD.bat ListAllAVDs
55+
56+
...
57+
58+
Command Examples:
59+
rootAVD.bat
60+
rootAVD.bat ListAllAVDs
61+
rootAVD.bat InstallApps
62+
63+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img
64+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img FAKEBOOTIMG
65+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img DEBUG PATCHFSTAB GetUSBHPmodZ
66+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img restore
67+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img InstallKernelModules
68+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img InstallPrebuiltKernelModules
69+
rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img InstallPrebuiltKernelModules GetUSBHPmodZ PATCHFSTAB DEBUG
70+
```
71+
72+
### 最新の Magisk をインストール
73+
74+
+ 最新のMagsiskを以下よりダウンロード
75+
76+
- https://github.com/topjohnwu/Magisk/releases
77+
78+
+ 「rootAVD\Apps」のフォルダにコピーする。
79+
+ 最新の Magisk をインストール
80+
81+
以下のコマンドを実行
82+
83+
```
84+
.\rootAVD.bat system-images\android-34\google_apis_playstore\x86_64\ramdisk.img
85+
```
86+
87+
### Magisk Module をインストール
88+
89+
以下のMagisk Module をインストールする。
90+
91+
- https://github.com/NVISOsecurity/MagiskTrustUserCerts/releases
92+
- https://github.com/LSPosed/LSPosed/releases (zygisk 版をインストール)
93+
94+
必要に応じて以下をインストール
95+
96+
- https://github.com/LSPosed/LSPosed.github.io/releases
97+
98+
### XposedModule Module をインストール
99+
100+
「OverrideSysPropModule」フォルダ内の XposedModule をインストール。
101+
102+
````
103+
cd OverrideSysPropModule\app\release
104+
adb install app-release.apk
105+
````
106+
107+
### Moduleを適用したいアプリに対して有効にする。
108+
109+
![OverrideSysProp](images/OverrideSysProp.png)
110+
111+
TIP: 端末を再起動しないとうまく認識しない場合がある。

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
namespace 'com.example.overridesysprop'
7+
compileSdk 33
8+
9+
defaultConfig {
10+
applicationId "com.example.overridesysprop"
11+
minSdk 23
12+
targetSdk 33
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
}
30+
31+
dependencies {
32+
compileOnly 'de.robv.android.xposed:api:82'
33+
compileOnly 'de.robv.android.xposed:api:82:sources'
34+
implementation 'androidx.appcompat:appcompat:1.4.1'
35+
implementation 'com.google.android.material:material:1.5.0'
36+
testImplementation 'junit:junit:4.13.2'
37+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
38+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
39+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/release/app-release.apk

2.92 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.example.overridesysprop",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.0",
16+
"outputFile": "app-release.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.overridesysprop;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.example.overridesysprop", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
<application
5+
android:allowBackup="true"
6+
android:dataExtractionRules="@xml/data_extraction_rules"
7+
android:fullBackupContent="@xml/backup_rules"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.OverrideSysPropModule"
12+
tools:targetApi="31">
13+
<meta-data
14+
android:name="xposedmodule"
15+
android:value="true" />
16+
<meta-data
17+
android:name="xposeddescription"
18+
android:value="Simple System Property Override Xposed Module" />
19+
<meta-data
20+
android:name="xposedminversion"
21+
android:value="53" />
22+
</application>
23+
</manifest>

app/src/main/assets/xposed_init

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.example.overridesysprop.MainModule

0 commit comments

Comments
 (0)