macOS记录
1 | MallocStackLogging=1 ./titanagent |
macos_ventura_note.md
CODE_SIGNING_MONITOR
xnu/bsd/kern/kern_codesigning.c
drop 32bit arm
xnu/bsd/sys/constrained_ctypes.h
xnu/bsd/sys/kdebug_triage.h
xnu/bsd/sys/trust_caches.h
xnu/config/MasterVersion
xnu/doc/memorystatus/overview.md
xnu/doc/sched_cond.md
Atomic Condition Variables for Thread Synchronization
xnu/osfmk/kern/cambria_layout.h
[+] xnu/osfmk/kern/iotrace.h
xnu/osfmk/kern/smr.c
SMR clocks have 3 state machines interacting at any given timea
kdebug_note.md
sudo ktrace trace -sS -p 62872 | grep test
export PATH=$PATH:/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS
instruments -d result.trace -t ‘System Trace’ /bin/ls
open result.trace
sudo ./kdv 23960 | grep BSC_
sudo ktrace trace -p 62872
sudo ktrace setopt -x 62872
sudo ktrace dump -T1 -p 62872
dump的过滤好像无效
ktrace dump trace001.trace
ktrace trace -R trace001.trace -p firefox
只能先dump再过滤???
https://github.com/nowsecure/fsmon
sudo ktrace setopt -x firefox
sudo ktrace dump -p firefox
bash inject
sudo mv /bin/bash /bin/bash_old
Password:
mv: rename /bin/bash to /bin/bash_old: Operation not permitted
macOS可能不具备bash注入能力
获取运行进程的CFBundleIdentifier
1 | sudo launchctl procinfo 48339 | grep CFBundleIdentifier | head -n1 | awk '{print $3}' |
获取bundleid根据bundleid打开应用
1 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep identifier: | awk '{print $2}' | sort -u |
macOS动态库
1 | tapi - Text-based |
1 | vtool -show /opt/homebrew/opt/qt/lib/QtSvg.framework/QtSvg | grep minos |
Network.framework
https://developer.apple.com/documentation/network
https://developer.apple.com/documentation/network/implementing_netcat_with_network_framework
https://developer.apple.com/documentation/network/taking_advantage_of_third-party_network_debugging_tools
1 | clang -framework Network -framework Security main.c -o nwcat |
Apple OSS上的CF(CoreFoundation)有些没有开源 比如Notification的实现
KDebug
https://github.com/matan1008/pykdebugparser
1 | pip install pykdebugparser |
1 | # dump的过滤好像无效 |
https://github.com/per-gron/shuriken/tree/master/src/shk-trace
https://github.com/dlevi309/kdebugView
https://github.com/nowsecure/fsmon
1 | sudo ktrace trace -s -S -t c -p 25317 | grep test |
1 | io.open("test.txt",'w') |
https://etcnotes.com/posts/system-call/
1 | export PATH=$PATH:/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS |
osquery endpointsecurity
1 | sudo osqueryi --disable_events=false --disable_audit=false --disable_endpointsecurity=false --audit_allow_config |
recovery mode (old system)
1 | sudo usr/sbin/nvram internet-recovery-mode=RecoveryModeNetwork |
WPS Office
1 | 4.1.2 1.67G |
OpenJDK Symlink
1 | sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk |
system_profiler
1 | system_profiler -json SPMemoryDataType |
redirect
1 | macOS |
brew services 命令解析
https://qiujunya.com/article/2019/6/23/23.html
mdutil
1 | https://zhuanlan.zhihu.com/p/231076209 |
macos13 Ventura虚拟机安装无网络问题
https://www.dhzy.fun/archives/4263.html
set hostname
1 | sudo scutil --set HostName wurui |
ibtool
1 | ibtool Window.xib --compile test.nib |
PlistBuddy简单使用
https://www.jianshu.com/p/2167f755c47e
csrutil
1 | [-bash-3.2# csrutil disable |
1 | M1芯片电脑添加系统扩展时提示:若要启用系统扩展,您需要在“恢复” |
关闭 OSX 10.11 SIP (System Integrity Protection) 功能
https://www.cnblogs.com/lsgxeva/p/11872185.html
1 | cat /System/Library/Sandbox/rootless.conf |
10.15关闭SIP后升级到12.0的情况
1 | $ csrutil status |
1 | System Integrity Protection status: unknown (Custom Configuration). |
macOS 12 进程注入漏洞破坏所有安全层
https://www.oschina.net/news/206685/process-injection-breaking-all-macos-security-layers
1 | 在 macOS 12.0.1 Monterey 中,苹果修复了编号为 CVE-2021-30873 的进程注入漏洞 (process injection),此漏洞影响所有基于 macOS AppKit 的应用。 |
xcdebug
Start a debugging session in Xcode.
xcode-select
Manages the active developer directory for Xcode and BSD tools
xctrace
Record, import, export and symbolicate Instruments .trace files.
1 | xctrace list devices |