macOS内核
macos_kernel.md
https://github.com/maurice-schuppe/flockflock
https://github.com/jzlka/macOS-monitoring-API-demos
macOS下Kext notarization
https://blog.csdn.net/tanhuang614/article/details/100552285
open /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
cp -R test.kext hello.kext
sudo chmod -R 755 hello.kext
sudo chown -R root:wheel hello.kext
cp -R FlockFlock.kext tmp.kext
sudo chmod -R 755 tmp.kext
sudo chown -R root:wheel tmp.kext
Mac 内核扩展开发
https://toutiao.io/posts/fhdsfj/preview
深入解析Mac OS X & iOS 操作系统 学习笔记(十五)
https://www.jianshu.com/p/96837976c1f8
Mac system extensions for threat detection: Part 3
https://www.elastic.co/blog/mac-system-extensions-for-threat-detection-part-3
On macOS Kernel/Kext Logging
https://rw.internals.io/post/on-macOS-kernel-kext-logging/
1 | log show --predicate 'senderImagePath CONTAINS "Echo"' |
1 |
|
com.apple.kpi.dsep -> mac_policy_register
com.apple.kpi.bsd -> vn_getpath
com.apple.kpi.libkern -> std c lib
1 | kextstat | grep kpi |
内核扩展
https://support.apple.com/zh-cn/guide/deployment/depa5fb8376f/web
在 macOS 11 或更高版本中,如果启用了第三方内核扩展 (Kext),就不能按需将其载入内核中。第三方内核扩展需要用户批准、重新启动 macOS 以将更改载入内核,还需要在搭载 Apple 芯片的 Mac 上将安全启动配置为“降低安全性”。
macOS内核拓展与用户态进程的通信实现(一)
https://www.jianshu.com/p/4268e02e7c4c
macOS内核拓展与用户态进程的通信实现(二)
https://www.jianshu.com/p/8318cabe9535
1 | IOServiceOpen |
DNS过滤
Socket Filter ->
1 |
|
NuwaStone
https://github.com/ConradSun/NuwaStone
A macOS behavior audit system with scope of file, process and network events.
file/process -> kauth
<=10.15 kauth vnode/fileop
=10.16(11.0) EndpointSecurity
network ->
<=10.15 sflt_register [NKE Network Kernel Extension KPI]
=10.16(11.0) NetworkExtension
vm_kernel_unslide_or_perm_external
https://github.com/AloneMonkey/MacKext/blob/master/AntiRootkit/macho/macho_utils.c
https://github.com/shinvou/SIPless Small KEXT to disable SIP on >= macOS 10.12.
https://github.com/snare/KernelResolver origin
https://github.com/leiless/ksymresolver
[转]Resolving kernel symbols
https://www.cnblogs.com/Proteas/p/4030779.html
https://www.bbsmax.com/A/nAJvmNb8zr/
Resolving Kernel Symbols Post-ASLR
https://www.zdziarski.com/blog/?p=6901
https://github.com/jzdziarski/kernelresolver/blob/master/kernel_resolver.c
Mac OS X内核编程,MAC驱动开发资源汇总
https://blog.csdn.net/majiakun1/article/details/78030073
Slides: Crafting macOS Root Kits
https://www.zdziarski.com/blog/?p=6909
https://www.zdziarski.com/blog/?cat=14
https://www.zdziarski.com/blog/wp-content/uploads/2017/02/Crafting-macOS-Root-Kits.pdf
1 | static int |
先检查macf 再检查kauth
1 |
|
https://github.com/leiless/ksymresolver
https://github.com/jzdziarski/kernelresolver
https://github.com/shinvou/SIPless.git
https://github.com/Ch4nc3n/HookSysCall.git
https://www.cs.dartmouth.edu/~sergey/cs108/guest_lectures/xnu-suggested-project.txt
https://man.netbsd.org/kauth.9
https://cs.dartmouth.edu/~sergey/cs258/
https://github.com/Andrej-Antipov/Kext-Install-Utility
1 | m_vnodeListener = kauth_listen_scope(KAUTH_SCOPE_VNODE, vnode_scope_callback, reinterpret_cast<void *>(this)); |
1 | static const char *scope_name[] = { |
1 | /* |
DNS Query
port = 53
阻止网络访问
Network Extension
NEFilterSocketFlow/NEAppProxyFlow/NENetworkRule
https://github.com/Paragon-Software-Group/paragon_firewall_ce
Paragon Firewall for Mac Community Edition
https://github.com/OlexiyKhokhlov/HeyApple
https://github.com/zeek/zeek-agent-v2/blob/main/src/platform/darwin/network-extension.mm
https://github.com/zeek/zeek
1 | return [NEFilterNewFlowVerdict dropVerdict]; |
Network Kernel Extension
1 | sflt_register |
https://qa.1r1g.com/sf/ask/4474923281/
https://developer.apple.com/fr/support/kernel-extensions/
实现 macOS 内核监控的几种方法
https://paper.seebug.org/380/
xnu_macos.md
libkdd
Kernel Data Descriptors
The KCDATA
format
osfmk
kdp
Kernel Debugging Protocol
KextViewr
Netiquette Network Monitor
FileMonitor
LuLu
MacFilter
SimpleFirewall
HeyApple
paragon_firewall_ce
MachOView
macOS-system-projects
hspGuard
Kext-Install-Utility
kernelresolver
KernelResolver
HookSysCall
MacKext
bsd_kext_log
blocker
BlockBlock
macOS-monitoring-API-demos
kemon
flockflock
os-x-ios-kernel-programming
osx_and_ios_kernel_programming
NuwaStone
HelloKernControl
LittleRooter
macprocmon
macOS-Security-and-Privacy-Guide
dsdump
valgrind-macos -> x64/not arm64
PureDarwin
OpenCorePkg
Masochist
LinkLiar
Surf
CloverBootloader
reverse-engineering-on-osx
LibSymbolize
idb
SandboxMirror
CoreSymbolication
liblorgnette
kdebugView
apple_internal_sdk
newosxbook-tools
dyld-shared-cache-extractor
iTerm2
OC-learn-master
LibraryInjector
ProcessMonitor
BSBacktraceLogger
HookCase
Security
awesome-iOS-resource
libimobiledevice
iOS_app_re_tools
objective-see.md
BlockBlock -> ES_EVENT_TYPE_AUTH_EXEC
FileMonitor ->
1 | es_event_type_t events[] = {ES_EVENT_TYPE_NOTIFY_CREATE, ES_EVENT_TYPE_NOTIFY_OPEN, ES_EVENT_TYPE_NOTIFY_WRITE, ES_EVENT_TYPE_NOTIFY_CLOSE, ES_EVENT_TYPE_NOTIFY_RENAME, ES_EVENT_TYPE_NOTIFY_LINK, ES_EVENT_TYPE_NOTIFY_UNLINK, ES_EVENT_TYPE_NOTIFY_EXEC, ES_EVENT_TYPE_NOTIFY_EXIT}; |
LuLu -> NetworkExtension
Netiquette ->
//wish there was a NetworkStatistics.h
// mahalo J. Levin:
// https://twitter.com/Morpheus______
// http://newosxbook.com/src.jl?tree=listings&file=netbottom.c
KnockKnock -> 各种检查
KextViewr -> kextstat
https://www.oschina.net/p/IosHackStudy