GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Pro版本更新4.5.4,修复32位情况下的一些安全痕迹。 · pigadmin/SKRoot-linuxKernelRoot@0a5abdc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Pro(众测开放中)/src/testModule/module_hide_data_dir
    • jni
      • Android.mk
    • module_hide_data_dir.cpp
    • patch_compat_filldir.cpp
    • patch_compat_filldir.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Pro(众测开放中)/src/testModule/module_hide_data_dir/jni/Android.mk‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/testModule/module_hide_data_dir/jni/Android.mk
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
33
include $(CLEAR_VARS)
44
LOCAL_MODULE := module_hide_data_dir
55

6-
LOCAL_SRC_FILES := ../module_hide_data_dir.cpp ../patch_base.cpp ../patch_filldir64.cpp ../cJSON.cpp
6+
LOCAL_SRC_FILES := ../module_hide_data_dir.cpp ../patch_base.cpp ../patch_filldir64.cpp ../patch_compat_filldir.cpp ../cJSON.cpp
77

88
KERNEL_MODULE_KIT := $(LOCAL_PATH)/../../kernel_module_kit
99
LOCAL_C_INCLUDES += $(KERNEL_MODULE_KIT)/include
Collapse file

‎Pro(众测开放中)/src/testModule/module_hide_data_dir/module_hide_data_dir.cpp‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/testModule/module_hide_data_dir/module_hide_data_dir.cpp
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <set>
33
#include <fstream>
44
#include "patch_filldir64.h"
5+
#include "patch_compat_filldir.h"
56
#include "kernel_module_kit_umbrella.h"
67
#include "simple_hash_util.h"
78
#include "cJSON.h"
@@ -70,6 +71,11 @@ static KModErr patch_kernel_handler(const HideDirConfig& config, const std::stri
7071
kernel_module::SymbolHit filldir64;
7172
RETURN_IF_ERROR(kernel_module::kallsyms_lookup_name("filldir64", filldir64, kernel_module::SymbolMatchMode::Prefix));
7273
printf("%s, addr: %p\n", filldir64.name, (void*)filldir64.addr);
74+
75+
kernel_module::SymbolHit compat_filldir;
76+
RETURN_IF_ERROR(kernel_module::kallsyms_lookup_name("compat_filldir", compat_filldir, kernel_module::SymbolMatchMode::Prefix));
77+
printf("%s, addr: %p\n", compat_filldir.name, (void*)compat_filldir.addr);
78+
7379
uint32_t cred_offset = 0;
7480
uint32_t cred_euid_offset = 0;
7581
uint32_t comm_offset = 0;
@@ -89,8 +95,15 @@ static KModErr patch_kernel_handler(const HideDirConfig& config, const std::stri
8995

9096
PatchBase patchBase(cred_offset, cred_euid_offset, comm_offset, whitelist_comm_name);
9197
PatchFilldir64 patchFilldir64(patchBase, filldir64.addr);
98+
PatchCompatFilldir patchCompatFilldir(patchBase, compat_filldir.addr);
99+
100+
92101
KModErr err = patchFilldir64.patch_filldir64(config.names, ino_set);
93102
printf("patch filldir64 ret: %s\n", to_string(err).c_str());
103+
RETURN_IF_ERROR(err);
104+
err = patchCompatFilldir.patch_compat_filldir(config.names, ino_set);
105+
printf("patch compat_filldir ret: %s\n", to_string(err).c_str());
106+
RETURN_IF_ERROR(err);
94107
return err;
95108
}
96109

@@ -139,7 +152,7 @@ class MyWebHttpHandler : public kernel_module::WebUIHttpHandler { // HTTP服务
139152
// SKRoot 模块名片
140153
// 字段说明见 module_descriptor.h
141154
SKROOT_MODULE_NAME("隐藏/data目录")
142-
SKROOT_MODULE_VERSION("2.0.0")
155+
SKROOT_MODULE_VERSION("2.0.1")
143156
SKROOT_MODULE_DESC("内核级隐藏 /data 指定目录,彻底阻断文件扫描;底层拦截机制,免疫各类基于漏洞的暴力扫盘。")
144157
SKROOT_MODULE_AUTHOR("SKRoot")
145158
SKROOT_MODULE_ID32("ae12076c010ebabbb233affdd0239c14")
Collapse file

‎Pro(众测开放中)/src/testModule/module_hide_data_dir/patch_compat_filldir.cpp‎

Copy file name to clipboard
+80Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#include "patch_compat_filldir.h"
2+
#include <vector>
3+
using namespace asmjit;
4+
using namespace asmjit::a64;
5+
using namespace asmjit::a64::Predicate;
6+
7+
PatchCompatFilldir::PatchCompatFilldir(const PatchBase& patch_base, uint64_t compat_filldir) : PatchBase(patch_base), m_compat_filldir(compat_filldir) {}
8+
9+
PatchCompatFilldir::~PatchCompatFilldir() {}
10+
11+
KModErr PatchCompatFilldir::patch_compat_filldir(const std::set<std::string>& names, const std::set<uint64_t>& ino_set) {
12+
GpX x1_name = x1;
13+
GpW w2_namelen = w2;
14+
GpX x4_ino = x4;
15+
16+
std::vector<std::string> hide_names(names.begin(), names.end());
17+
std::vector<uint64_t> hide_inos(ino_set.begin(), ino_set.end());
18+
19+
// 生成Hook func汇编命令
20+
aarch64_asm_ctx asm_ctx = init_aarch64_asm();
21+
auto a = asm_ctx.assembler();
22+
Label L_allow_visible = a->newLabel();
23+
24+
// 这里下面是内核态要运行的指令
25+
kernel_module::arm64_before_hook_start(a);
26+
27+
// 比较进程名,放行白名单进程名。
28+
emit_check_current_allow_visible_to_x10(a);
29+
a->cbnz(x10, L_allow_visible);
30+
31+
// 按目录名称隐藏
32+
for (size_t i = 0; i < hide_names.size(); ++i) {
33+
Label L_next = a->newLabel();
34+
35+
const auto& dir_name = hide_names[i];
36+
aarch64_asm_mov_w(a, w11, dir_name.length());
37+
a->cmp(w2_namelen, w11);
38+
a->b(CondCode::kNE, L_next); //下一个
39+
40+
// memcmp key
41+
aarch64_asm_set_x_cstr_ptr(a, x12, dir_name);
42+
{
43+
RegProtectGuard g1(a, x0);
44+
kernel_module::string_ops::kmemcmp(a, x1_name, x12, x11);
45+
a->mov(x11, x0);
46+
}
47+
a->cbnz(x11, L_next); //不相等,下一个
48+
49+
// 隐藏文件夹的返回
50+
if (kernel_module::is_kernel_version_less("6.1.0")) {
51+
a->mov(x0, xzr);
52+
} else {
53+
a->mov(x0, Imm(1));
54+
}
55+
kernel_module::arm64_before_hook_end(a, false); // 直接返回,不跳回原函数
56+
57+
a->bind(L_next);
58+
}
59+
60+
// 按完整路径隐藏
61+
for (size_t i = 0; i < hide_inos.size(); ++i) {
62+
Label L_next = a->newLabel();
63+
aarch64_asm_mov_x(a, x11, hide_inos[i]);
64+
a->cmp(x4_ino, x11);
65+
a->b(CondCode::kNE, L_next); //下一个
66+
67+
// 隐藏文件夹的返回
68+
if (kernel_module::is_kernel_version_less("6.1.0")) {
69+
a->mov(x0, xzr);
70+
} else {
71+
a->mov(x0, Imm(1));
72+
}
73+
kernel_module::arm64_before_hook_end(a, false); // 直接返回,不跳回原函数
74+
a->bind(L_next);
75+
}
76+
77+
a->bind(L_allow_visible);
78+
kernel_module::arm64_before_hook_end(a, true); // 正常返回
79+
return patch_kernel_before_hook(m_compat_filldir, a);
80+
}
Collapse file

‎Pro(众测开放中)/src/testModule/module_hide_data_dir/patch_compat_filldir.h‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
#include <iostream>
3+
#include <set>
4+
#include "patch_base.h"
5+
6+
class PatchCompatFilldir : public PatchBase {
7+
public:
8+
PatchCompatFilldir(const PatchBase& patch_base, uint64_t compat_filldir);
9+
~PatchCompatFilldir();
10+
11+
KModErr patch_compat_filldir(const std::set<std::string>& names, const std::set<uint64_t>& ino_set);
12+
private:
13+
uint64_t m_compat_filldir = 0;
14+
};

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.