Skip to content

gmh5225/FakeSign

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

自建时间戳服务器实现伪签名驱动证书

Implementing Pseudo Signature with Self-Sign Timestamp Servers

自建时间戳服务器实现伪签名驱动证书

免责声明 / Disclaimers

[Disclaimers - English] This article involves network security experiments. Reading this article indicates that you have read, fully understand, and promise to comply with all the following terms and conditions: > 1. You promise that the technology involved in this article will only be used for experimentation and security technology testing, and shall not be used for any criminal activities, fraud or cracking, nor for production environments that require confidentiality or importance. > 2. You comply with the Cybersecurity Law of the People's Republic of China and are not allowed to use any technology on this website for illegal or criminal activities. > 3. You shall comply with Article 286 (1) of the Criminal Law and shall not use any technology on this website to disrupt computer information systems. > 4. You shall comply with Article 32 of the Electronic Signature Law and shall not use any technology of this website to forge, impersonate, or embezzle the electronic signature of others > If any of the above terms are violated, we will fully and independently assume any legal and other responsibilities that may arise.
**本文涉及网络安全实验,阅读本文表示您已经阅读、完全理解并承诺遵守下列条款的全部内容**:

1、您承诺本文涉及的技术只被用于实验和安全技术测试,不得用于任何违反犯罪活动,不得用于欺诈或破解,不用于需要保密或者重要的生产环境。 2、您遵守《中华人民共和国网络安全法》,不得使用本网站任何技术进行违法犯罪活动。 3、您遵守《刑法》第286条第1款规定,不得使用本网站的任何技术破坏计算机信息系统。 4、您遵守《电子签名法》第32条,不得使用本网站的任何技术伪造、冒用、盗用他人的电子签名 5、您遵守中国以及其他所在国家和地区的法律法规,不得使用本网站的任何技术违反法律法规,或者给其他任何个人、团体造成问题或者损失。 如果违反上述条款的任何内容,将完全独立承担带来的任何法律以及其他责任。

实现原理 / Principle

  • 微软内核模式驱动代码签名要求:

    20230425155145

    适用于: Windows Vista、Windows 7;带安全启动的 Windows 8+ Windows 8、Windows 8.1、Windows 10 版本 1507、1511 以及安全启动 Windows 10 版本 1607、1703、1709 以及安全启动 Windows 10 版本 1803 及安全启动
    架构: 仅 64 位,32 位不需要签名 64 位、32 位 64 位、32 位 64 位、32 位
    需要签名: 嵌入文件或目录文件 嵌入文件或目录文件 嵌入文件或目录文件 嵌入文件或目录文件
    签名算法: SHA2 SHA2 SHA2 SHA2
    证书: 代码完整性信任的标准根 代码完整性信任的标准根 Microsoft 根证书颁发机构 2010、Microsoft 根证书颁发机构、Microsoft 根证书颁发机构 Microsoft 根证书颁发机构 2010、Microsoft 根证书颁发机构、Microsoft 根证书颁发机构
    • Windows 10 1607 及更新版本

      • 如果EV代码签名证书是2015/07/19及以前由微软交叉签名的CA颁发的证书:
        • (必须)签署EV代码签名证书:SHA2(SHA256,SHA1实测仍然可以)
      • 如果EV代码签名证书是2015/07/19及以后(微软交叉签名)CA颁发的证书:
        • (必须)签署微软WHQL签名:SHA1/SHA2(SHA256,SHA1目前可以)
        • (可选)签署EV代码签名证书:SHA2(SHA256,微软官方不允许SHA1)
    • Windows 10 1607 之前的版本(到Vista/Win7/Win8/8.1)

      • (必须)签署EV代码签名证书:SHA1/SHA2(SHA256,SHA1实测仍然可以)
      • 对于某些旧版Win7及之前的版本,可能不支持SHA256
    • Windows XP/2000,更早的系统不要求内核驱动强制签名

      • (可选)普通代码签名证书:SHA1(不支持SHA256)
  • 微软禁用内核驱动强制签名方法:

    • Windows 10 1607 之后UEFI引导模式,并且开启Secure Boot选项:

      • 无法开启测试模式,不能通过修改BCD解决可以使用EFIGuard

      • 每次可以开机进入高级模式-选择禁用内核驱动强制签名启动

    • Windows 10 1607 之前,Win8/8.1/7/Vista,或者关闭Secure Boot:

      • 开启测试模式

        bcdedit /enum all
        bcdedit /set {default} testsigning on
        bcdedit /set nointegritychecks on
        bcdedit /set testsigning on
        bcdedit /debug ON
        bcdedit /bootdebug ON
      • 也可以每次可以开机进入高级模式-选择禁用内核驱动强制签名启动

  • 签名验证原理

    签名验证原理

    • 对二进制文件校验摘要(SHA1/SHA256)
    • 检查摘要是否与记录的符合
    • 使用公钥校验摘要的签名正确
    • 校验签名的证书是否有效,是否为EV证书
    • 逐级向上校验证书信任链是否有效
    • 检查CA是否被信任
    • 检查CA证书是否被微软驱动CA交叉签名
  • 伪造签名原理

    伪造签名原理

快速使用 / QuickUse

CA证书:用于时间戳认证 / CA Certificate: Used for Timestamp Auth

二选一,需要和下面签名工具的时间戳证书一致

泄漏的过期签名代码证书 / Leaked Expired Signature Code Certificate

需要2015-07-29及以前的EV代码签名证书我不提供任何代码签名证书

EV code signing certificates from July 29, 2015 and earlier are required,

I do NOT provide any code signing certificates

亚洲诚信数字签名工具包 / TrustAsia Digital Signature Toolkit Modify

下载工具 / Download Tools

二选一,需要和之前安装的CA证书一致

使用方法 / Signature Usage

  1. 安装过期EV代码签名证书
  2. 编辑hook.ini,设置时间

    设置时间规则

    • 在证书有效期之内
    • 在证书被吊销之前

      (建议设置到接近证书的生效日期,因为很多证书都被吊销了)

    • 建议2015-07-29前

    设置时间

  3. 打开工具DSignTool.exe

    会提示时间戳日期

    20230406174916

  4. 添加规则

    20230406175056

  5. 签名文件

    20230406175256

其他工具:微软SignTool / Other tools: Microsoft SignTool CMD Usage

签名方法 / Signature Method

signtool timestamp /t "http://<服务器地址>/{SHA1|SHA256}/YYYY-MM-DDTHH:mm:ss" <待签名程序>

签名示例 / Signature Example

signtool timestamp /t "http://time.pika.net.cn/fake/RSA/SHA1/2011-01-01T00:00:00" test.exe
signtool timestamp /tp 1 /tr "http://time.pika.net.cn/fake/RSA/SHA256/2011-01-01T00:00:00" test.exe

搭建服务 / TS Server

VS编译构建时间戳服务器

  • 下载项目

    git clone https://github.com/PIKACHUIM/FakeSign.git
  • 修改代码

    编辑:TSServer/Develop/TimeStamping/Program.cs

    static readonly string supportFake = @"true";

    如果要使用伪造服务器,则此处填写true,如果要使用真实时间,应当填写false

  • 编译构建

    输出:TSServer/Develop/TimeStamping/bin/Debug

Windows部署服务(推荐)

  • 双击:TimeStamping.exe即可运行

Ubuntu部署服务(不推荐)

安装Wine

sudo dpkg --add-architecture i386
sudo apt-get install wine mono-complete winetricks wine32 winbind

安装.Net

  • 自动安装
    sudo winetricks dotnet45
  • 手动安装

    1. 下载文件 wine-mono-7.4.0-x86.msi

    2. wine uninstaller
      wine64 uninstaller

      安装上一步下载的MSI文件(wine-mono-7.4.0-x86.msi)

      安装MSI文件

  • 运行服务

    wine TimeStamping.exe

签名工具 / Sign Tool

VS编译HookSigntool

  • 下载项目

    git clone https://github.com/PIKACHUIM/FakeSign.git
  • 修改代码

    编辑:SignTool/Hooktool/main.cpp

    if (!_wcsicmp(lpOriginalTS, L"{CustomTimestampMarker-SHA1}")) {
            wcscat(buf, L"http://time.pika.net.cn/fake/RSA/");
            wcscat(buf, lpTimestamp);
            return buf;
        }
        else if (!_wcsicmp(lpOriginalTS, L"{CustomTimestampMarker-SHA256}")) {
            wcscat(buf, L"http://time.pika.net.cn/fake/RSA/");
            wcscat(buf, lpTimestamp);
            return buf;
        }

    将里面的http://time.pika.net.cn/fake/RSA/修改为http://你的地址/路径

  • 编译构建

    输出:SignTool/Hooktool/bin/Debug

参考资料 / Reference

[1] 时间戳签名库以及本地Demo服务器,可以倒填时间制造有效签名,JemmyloveJenny,吾爱破解,https://www.52pojie.cn/thread-908684-1-1.html

[2] 亚洲诚信数字签名工具修改版 自定义时间戳 驱动签名,JemmyloveJenny,吾爱破解,https://www.52pojie.cn/thread-1027420-1-1.html

[3] 关于Windows驱动签名认证的大致总结,ANY_LNK,BiliBili,https://www.bilibili.com/read/cv17812616

About

自建时间戳服务器实现伪签名驱动证书 Implementing Pseudo Signature with Self-Sign Timestamp Servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Tcl 85.2%
  • HTML 7.6%
  • C++ 2.5%
  • PLSQL 1.2%
  • Roff 1.1%
  • C# 1.0%
  • Other 1.4%