ebpf入门
eBPF(extended Berkeley Packet Filter),ebpf 支持程序在不修改内核源码,或添加额外内核模块情况下运行,添加内核新功能。 架构 用户态 用户编写 ebpf 程序,可使用 ebpf 汇编或者 ebpf 特有 c 语言编写; 使用 llvm/clang 编译器,将 ebpf 程序编译为 ebpf 字节码; 调用 bpf() 系统调用将 eBPF 字节码加载到内核 内核态 ebpf 字节码到内核时,内核会先对其进行安全验证; 使用 JIT (Just In Time)将 字节码编译为本地机器码; 根据 eBPF 程序功能,将机器码挂载到内核的不同运行路径上(例如跟踪内核运行状态的ebpf 程序会挂载在 kprobes 的运行路径上)。当内核运行到这些路径上,就会触发执行相应路径上的 eBPF 机器码; 原文拿来和 JAVA 的 AOP 概念做类比,这里由于本人没有 java 基础,所以不再赘述,感觉只是挂钩函数功能而已,欢迎评论区指正...
CVE-2022-20421 漏洞复现
CVE漏洞编号:CVE-2022-20421google bulletin:https://source.android.com/docs/security/bulletin/2022-10-01?hl=zh-cn相关patch commit:https://android.googlesource.com/kernel/common/+/19bb609b45fb 环境搭建aosp编译报错:not found libncurses.so.5debian 版本太新,需要下载较老的库并放入 /lib/x86-…/ 中 libncurses.so.5 libtinfo.so.5 android-kernel 选择较老的分支:android-gs-raviole-5.10-android12-d1 1234repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/kernel/manifest -b android-gs-raviole-5.10-android12-d1repo init...
template for obsidian
Overviewbinder 为 Android 层为不同进程之间实现 IPC 通信的系统组件,由于在 SELinux 保护下,untrusted_app 以及 isolated_app 也可以访问 binder,因此攻击面较广。binder 中用于并行同步的原语包括:5个锁,6个引用计数器,一些原子变量binder 上提权 root 的历史漏洞: CVE-2019-2025 Waterdrop: slides, video CVE-2019-2215 Bad Binder: blog, video CVE-2020-0041: blog CVE-2020-0423 Typhoon Mangkhut: slides, video CVE-2022-20421 Bad Spin: whitepaper, video Making an RPC call with Binder与 binder 的交互方式。通过 /dev/binder 设备文件进行交互。 12int fd = open("/dev/binder", O_RDWR, 0);void *map...
Steam-for-Linux-CheetSheet
记录一些在 linux 上配置 steam 以及 proton 的 tricks protonproton 管理工具:protonplus proton-ge-custom dwproton cachyos-proton 启动选项仅 Nvidia显卡: 1__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json gamemoderun %command% 设置 cache: 1__GL_SHADER_DISK_CACHE=1 设置 steam 预编译着色器缓存使用 cpu 核数: 12# ~/.steam/steam/steam_dev.cfgunShaderBackgroundProcessingThreads <cpu-num> ESYNC, FSYNC,...
Android 内核编译模拟
环境配置硬件配置64GB内存 软件包 aosp android-kernel Android Studio adb 等 android-tools 1sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig rsync 1234export REPO=$(mktemp /tmp/repo.XXXXXXXXX)curl -o ${REPO} https://storage.googleapis.com/git-repo-downloads/repogpg --recv-keys 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65curl -s...
CVE-2025-32463漏洞复现
尝试复现并分析调试今年的一个 sudo 本地提权漏洞。该漏洞描述如下: Sudo before 1.9.17p1 allows local users to obtain root access because /etc/nsswitch.conf from a user-controlled directory is used with the –chroot option. 环境搭建建议环境 glibc 版本 > 2.35,否则无法复现。git clone sudo 的源码: 123git clone https://github.com/sudo-project/sudo.gitcd sudogit checkout v1.9.16p2 编译: 123./configuremake -j$(nproc)sudo make install make install 会安装到 /usr/local/bin ,先将原来的 /usr/bin/sudo...
LibAFL-for-socket
学习一下如何使用 LibAFL 来实现对 binary-only 的 socket 进行 fuzz。LibAFL 本身提供了 binary-only 模式,即 LibAFL-Qemu。然后针对 binary-only 的 socket 目标 AFL++ 也提供了常见的方法。这里我们采用 LibAFL-Qemu + socketfuzz hook library 的方法。 baby_fuzzer of LibAFL-QEMU首先阅读 LibAFL 提供的 LibAFL-QEMU 的几个实例,由于 frida_mode 目前相较于 qemu_mode 功能仍有所欠缺,我们仅考虑 qemu 模式。官方给的几个例子中 qemu_launcher 是比较完整可以直接拿来用的。要跑起来直接 just run 即可,其脚本会自动下载 libpng 的库并编译 harness 来进行 fuzz。这里我是自己先写了一个很简单的 harness.cc 来做测试,基本逻辑和 LibAFL 的 babyfuzzer...
NVIM-CheetSheet
nvim 比较好用的快捷键 123456789101112131415161718# 文件编辑# 移动<Ctrl> + H/J/K/L: 窗口间切换<Shift> + H/J/K/L: buffer间切换# explorera: 新建文件d: 删除r: 重命名# 窗口管理<whitespace> + w: 窗口管理<whitespace> + e/E: 打开 explorer<whitespace> + s/v: 分割窗口 # 缓冲区管理:b + d: 删除 buffer 配置 lazyvim 插件 treesitter+lua插件: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556return { "nvim-treesitter/nvim-treesitter", lazy = false, -- 禁止延迟加载 ...
LibAFL 工具使用
学习 libAFL 工具的一些基本使用方法。 环境 Ubuntu 22.04 clang rust LibAFL 源码首先从 github 下载 LibAFL 源码:1git clone https://github.com/AFLplusplus/LibAFL.git 教程建议安装 mdbook 然后查看 repo 的版本。 12cd ./libAFL/docsmdbook serve 编译运行编译 LibAFL直接使用 cargo 运行以下命令即可(Debug mode 要比 release mode 慢 10 倍以上): 1cargo build --release 编译 fuzzer 示例在 ./fuzzers/<Fuzzer_name> 目录下执行 cargo build --release 命令 CratesLibAFL 包含各种部件,自身也是。因此可以直接在自己的项目 Cargo.toml 中添加 libafl 依赖即可: 12[dependencies]libafl = { version =...
C/C++ Socket编程入门
在学习 LibFuzzer,需要了解一下如何通过 C 或者 C++ 与目标建立连接。 基本概念socket(套接字)用于建立两个或多个节点间的数据通信,分为服务端和客户端。偷一张感觉比较清晰的图放在这里 例程以下是直接扒的示例程序,由C语言实现,暂时看这个以及上面的图就够用了 服务器端代码实现1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#include <stdio.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <arpa/inet.h>#include <sys/socket.h>#include <netinet/in.h>int main(){ // 创建套接字 int serv_sock = socket(AF_INET,...
.jpg)
.jpg)
.jpg)
.jpg)
.jpg)
.jpg)
.jpg)