NTFS、ADS 简介
NTFS(New Technology File System):windows内核支持的文件系统
ADS(alternate data streams):交换数据流,可视为文件
NTFS 与 ADS 之间的关系类似于:宿主文件(NTFS下的文件) 与 寄生文件(ADS)
1、ADS可单独存在,也可与宿主文件关联存在
2、单个宿主文件,可有多个不同名的ADS
3、ADS 无后缀限制,可无后缀
ADS的格式
1、文件名:流名:流类型 // FILE.txt:ADS.exe:$DATA
2、:流名:流类型 // :ADS.pdf:$DATA,无宿主文件 ,单独存在
创建ADS
// 显示ADS命令 dir /r
// 通过文件写 ADS
echo "file test" > FILE.txt:ADS.exe // 创建 FILE.txt:ADS.exe:$DATA
notepad FILE.txt:ADS.exe // "file test"
// 通过目录写 ADS
echo "dir test" > DIR:ADS.exe // 创建 DIR:ADS.exe:$DATA,DIR目录须存在
notepad DIR:ADS.exe // "dir test"
// 通过磁盘写 ADS
C:\Users\Administrator>echo "C:\ test !!!" > C:\:ADS.exe
C:\>dir /r Users // 创建 ..:ADS.exe:$DATA,ADS附加在C盘根目录,所有一级子目录的 ".." 上
C:\Users\Administrator>notepad C:\:ADS.exe // "C:\ test !!!"
// 单独创建 ADS
echo "TEST file" >:ADS.png // 创建 :ADS.png:$DATA
notepad :ADS.png // 报错:文件名、目录名或卷标语法不正确,用 NtfsStreamsEditor
显示ADS
1、dir /r
2、.\streams64.exe -s // https://learn.microsoft.com/en-us/sysinternals/downloads/streams
3、NtfsStreamsEditor // https://github.com/studycpp/NtfsStreamsEditor
读ADS内容
1、notepad // 尽量用 busybox.exe,notepad支持不行
2、more < FILE.txt:ADS.exe // more 须用重定向
// https://frippery.org/busybox/
3、busybox.exe cat FILE.txt:ADS.exe // nl、less 都行,优先用cmd,powershell会报错
4、NtfsStreamsEditor // 查看单独ADS的内容,对ADS进行(扫描、导入/导出、备份/还原)
删除ADS
streams64.exe -d FILE.txt // 删除指定文件的 ADS
streams64.exe -s -d // 删除当前目录下所有 ADS,谨慎使用
NTFS支持ADS,把ADS复制到 非NTFS中,将丢弃ADS // 非NTFS:FAT32(U盘)、ext4(linux)
执行ADS
// https://live.sysinternals.com/tcpview64.exe
// https://live.sysinternals.com/PsExec64.exe
type tcpview64.exe > TEST.txt:TCP.exe
PsExec64.exe -d TEST.txt:TCP.exe // 弹出 TCPView,PID
sysinternals
https://learn.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite
https://live.sysinternals.com/ // 这儿更全
浏览器ADS
// IE、Edge、Chrome、firefox等下载的文件会添加ADS
(IE)MicrosoftEdgeSetup.exe:Zone.Identifier:$DATA Book.pdf:Zone.Identifier:$DATA
busybox64.exe nl busybox64.exe:Zone.Identifier
1 [ZoneTransfer]
2 ZoneId=3
3 ReferrerUrl=https://frippery.org/busybox/
4 HostUrl=https://frippery.org/files/busybox/busybox64.exe
学习 ADS(NTFS数据流),长了不少见识,记录一下
参考:
https://blog.nsfocus.net/ntfs-alternate-data-streams/
https://blog.csdn.net/AmrYu/article/details/122770431
|