搜索
查看: 7952|回复: 18

[AMXX 带源码] 关于防范HLDS Exploits Hl boom 炸服的想法

[复制链接]
发表于 2012-12-15 15:36:28 | 显示全部楼层 |阅读模式 来自 吉林长春
本帖最后由 neverneverdead 于 2013-1-4 19:27 编辑

既然大家已经知道Hl boom 是一个CS的漏洞,而且很多服务器深受其害,那么为什么那些能够阻止这一切发生的人要在这时候销声匿迹呢?

想法说到这,我对编程一窍不通,但是,我在国外网站上看到了有关Hlboom漏洞的一些小道消息,希望能给善良的人以提示。
Hlboom漏洞:
Half-life uses a header in the splitted packets which is 9 bytes big.
When a splitted packet is found (the first 4 bytes are "fe ff ff ff")
the game performs a memcpy() on the data after this header.
If the packet if compsed by a total of 8 bytes (instead of at least 9)
the game will try to copy "packet_size - header_size" bytes, so "8 - 9"
which means 0xffffffff.
Exists also another problem which happens during the handling of the
data in the splitted packets.
This bug is not 100% clear anyway seems related to the position of the
splits and the resulted size.
On Windows for example is possible to force the reading of the data in
an arbitrary offset of the memory.
No other debugging has been made on this bug.

希望明白编程的人看到后,能够做成品来,发到我的邮箱里,谢谢了。
邮箱:1033859886@qq.com

HL boom 防炸补丁

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2012-12-15 15:40:19 | 显示全部楼层 来自 吉林长春
防范代码如下:
  1. ====================================================================================
  2. #
  3. TITLE
  4.     Half-Life x.1.1.1e (Windows and Linux) hlboom fix 0.1
  5.     by Luigi Auriemma
  6.     e-mail: aluigi@autistici.org
  7.     web:    aluigi.org

  8. INTRO
  9.     This patch is referred to the following advisory and corrects both the bugs:
  10.     .
  11.     . http://aluigi.org/adv/hlboom-adv.txt
  12.     .
  13.     Remember to test your server with the proof-of-concept provided in the advisory
  14.     .
  15.     Note that the patch about the so called new hlboom crash should be considered
  16.     experimental and it could give problems to the clients which use too much
  17.     splitted packets since my solution drops all the splits major than 1/?? (which
  18.     lead to the crash of the unpatched server), anyway in my tests everything
  19.     worked perfectly.
  20.     .
  21.     This patch has been created only for the latest known patches for the dedicated
  22.     server 4.1.1.1e/3.1.1.1e of both Windows (swds.dll) and Linux (engine* amd,
  23.     i486 and i686), older versions will be NOT supported by me so don't ask

  24. FILE
  25.     swds.dll;engine*.so


  26.     ;####################################;
  27.     #          old HLBOOM crash          #
  28.     ;####################################;


  29.     ; Windows

  30. BYTES_ORIGINAL
  31.     90 90 90 90 90          ; nops for the patch
  32.     90 90 90 90
  33.       *5a                   ; bytes to skip
  34.     8B 4D 0C                ; mov ecx, dword ptr [ebp+0C]
  35.     8B 04 BD ?? ?? ?? ??    ; mov eax, dword ptr [4*edi+00DF0F44]
  36.     83 E9 09                ; sub ecx, 00000009
  37.     3B C6                   ; cmp eax, esi
  38.     89 4D 0C                ; mov dword ptr [ebp+0C], ecx
  39.     0F 84 ?? 00 00 00       ; je 00D4834F

  40. BYTES_PATCH
  41.     83 E9 09                ; sub ecx, 00000009
  42.     7F 02                   ; jg +2
  43.     33 C9                   ; xor ecx, ecx
  44.     EB 67                   ; jmp old code
  45.       *5a                   ; ...skip...
  46.     8B 4D 0C                ; mov ecx, dword ptr [ebp+0C]
  47.     8B 04 BD ?? ?? ?? ??    ; mov eax, dword ptr [4*edi+00DF0F44]
  48.     EB 91                   ; jmp patch
  49.     90
  50.     3B C6                   ; cmp eax, esi
  51.     89 4D 0C                ; mov dword ptr [ebp+0C], ecx
  52.     0F 84 ?? 00 00 00       ; je 00D4834F


  53.     ; Linux AMD

  54. BYTES_ORIGINAL
  55.     8d 83 ?? ?? ?? ??       ; lea    eax,[ebx-0x161e8]
  56.     8d 14 88                ; lea    edx,[eax+ecx*4]
  57.     83 44 24 34 f7          ; add    DWORD PTR [esp+52],0xfffffff7
  58.     89 44 24 18             ; mov    DWORD PTR [esp+24],eax
  59.     39 3a                   ; cmp    DWORD PTR [edx],edi
  60.     0f 84 ?? 00 00 00       ; je     a3320
  61.         *1ed                ; ...skip...
  62.     90 90 90 90 90          ; nops for the patch
  63.     90 90 90 90 90

  64. BYTES_PATCH
  65.     8d 83 ?? ?? ?? ??       ; lea    eax,[ebx-0x161e8]
  66.     8d 14 88                ; lea    edx,[eax+ecx*4]
  67.     e8 |1f9                 ; call   patch
  68.     89 44 24 18             ; mov    DWORD PTR [esp+24],eax
  69.     39 3a                   ; cmp    DWORD PTR [edx],edi
  70.     0f 84 ?? 00 00 00       ; je     a3320
  71.         *1ed                ; ...skip...
  72.     83 44 24 38 f7          ; add    DWORD PTR [esp+56],0xfffffff7  // +4!!!
  73.     7F 02                   ; jg     +2
  74.     89 3a                   ; mov    DWORD PTR [edx],edi            // forces give up
  75.     C3                      ; ret


  76.     ; Linux i486

  77. BYTES_ORIGINAL
  78.     83 45 0c f7             ; add    DWORD PTR [ebp+12],0xfffffff7
  79.     8d 83 34 22 ff ff       ; lea    eax,[ebx-0xddcc]
  80.     8d 0c b5 00 00 00 00    ; lea    ecx,[esi*4]
  81.     89 45 f0                ; mov    DWORD PTR [ebp-16],eax
  82.     8b 55 f8                ; mov    edx,DWORD PTR [ebp-8]
  83.     39 14 01                ; cmp    DWORD PTR [ecx+eax],edx
  84.     0f 84 ?? 00 00 00       ; je     a5ac0
  85.         *6ae                ; ...skip...
  86.     90 90 90 90 90          ; nops for the patch
  87.     90 90 90 90 90

  88. BYTES_PATCH
  89.     8d 83 34 22 ff ff       ; lea    eax,[ebx-0xddcc]
  90.     89 f1                   ; mov    ecx,esi
  91.     c1 e1 02                ; shl    ecx,0x2
  92.     90
  93.     e8 |6bd                 ; call   patch
  94.     89 45 f0                ; mov    DWORD PTR [ebp-16],eax
  95.     8b 55 f8                ; mov    edx,DWORD PTR [ebp-8]
  96.     39 14 01                ; cmp    DWORD PTR [ecx+eax],edx
  97.     0f 84 ?? 00 00 00       ; je     a5ac0
  98.         *6ae                ; ...skip...
  99.     83 45 0c f7             ; add    DWORD PTR [ebp+12],0xfffffff7
  100.     7F 03                   ; jg     +3
  101.     89 14 01                ; mov    DWORD PTR [ecx+eax],edx        // forces give up
  102.     C3                      ; ret


  103.     ; Linux i686

  104. BYTES_ORIGINAL
  105.     83 44 24 34 f7          ; add    DWORD PTR [esp+52],0xfffffff7
  106.     8d 83 c8 9a fe ff       ; lea    eax,[ebx-0x16538]
  107.     8d 14 88                ; lea    edx,[eax+ecx*4]
  108.     89 44 24 18             ; mov    DWORD PTR [esp+24],eax
  109.     39 3a                   ; cmp    DWORD PTR [edx],edi
  110.     0f 84 ?? 00 00 00       ; je     a3bb0
  111.         *39b                ; ...skip...
  112.     90 90 90 90 90          ; nops for the patch
  113.     90 90 90 90 90

  114. BYTES_PATCH
  115.     8d 83 c8 9a fe ff       ; lea    eax,[ebx-0x16538]
  116.     8d 14 88                ; lea    edx,[eax+ecx*4]
  117.     e8 |3a7                 ; call   patch
  118.     89 44 24 18             ; mov    DWORD PTR [esp+24],eax
  119.     39 3a                   ; cmp    DWORD PTR [edx],edi
  120.     0f 84 ?? 00 00 00       ; je     a3bb0
  121.         *39b                ; ...skip...
  122.     83 44 24 38 f7          ; add    DWORD PTR [esp+56],0xfffffff7  // +4!!!
  123.     7F 02                   ; jg     +2
  124.     89 3a                   ; mov    DWORD PTR [edx],edi            // forces give up
  125.     C3                      ; ret


  126.     ;####################################;
  127.     #          new HLBOOM crash          #
  128.     ;####################################;


  129.     ; Windows

  130. BYTES_ORIGINAL
  131.     8B 70 04                ; mov esi, dword[eax+04]
  132.     8A 40 08                ; mov al, byte[eax+08]
  133.     88 45 FC                ; mov byte[ebp-04], al
  134.     8B 45 FC                ; mov eax, dword[ebp-04]
  135.     25 FF 00 00 00          ; and eax, 000000FF

  136. BYTES_PATCH
  137.     8B 70 04                ; mov esi, dword[eax+04]
  138.     0F B6 40 08             ; movzx eax, byte[eax+08]
  139.     A8 F0                   ; test al, F0
  140.     74 02                   ; jz +2
  141.     32 C0                   ; xor al, al
  142.     88 45 FC                ; mov byte[ebp-04], al
  143.     90


  144.     ; Linux AMD

  145. BYTES_ORIGINAL
  146.     90 90 90 90 90 90       ; nops for the patch
  147.     90 90 90 90 90 90       ; nops for the patch
  148.         *637                ; ...skip...
  149.     8b 44 24 30             ; mov    eax,DWORD PTR [esp+48]
  150.     bd 0f 00 00 00          ; mov    ebp,0xf
  151.     8b 78 04                ; mov    edi,DWORD PTR [eax+4]
  152.     8a 50 08                ; mov    dl,BYTE PTR [eax+8]
  153.     88 d0                   ; mov    al,dl
  154.     c0 e8 04                ; shr    al,0x4

  155. BYTES_PATCH
  156.     88 d0                   ; mov    al,dl
  157.     c0 e8 04                ; shr    al,0x4
  158.     84 c0                   ; test   al,al
  159.     74 02                   ; jz     +2
  160.     30 c0                   ; xor    al,al
  161.     c3                      ; ret
  162.         *637                ; ...skip...
  163.     8b 44 24 30             ; mov    eax,DWORD PTR [esp+48]
  164.     bd 0f 00 00 00          ; mov    ebp,0xf
  165.     8b 78 04                ; mov    edi,DWORD PTR [eax+4]
  166.     8a 50 08                ; mov    dl,BYTE PTR [eax+8]
  167.     e8 |-657                ; call patch


  168.     ; Linux i486

  169. BYTES_ORIGINAL
  170.     90 90 90 90 90 90       ; nops for the patch
  171.     90 90 90 90 90 90       ; nops for the patch
  172.         *f86                ; ...skip...
  173.     8b 45 08                ; mov    eax,DWORD PTR [ebp+8]
  174.     8b 4d 08                ; mov    ecx,DWORD PTR [ebp+8]
  175.     8b 40 04                ; mov    eax,DWORD PTR [eax+4]
  176.     89 45 f8                ; mov    DWORD PTR [ebp-8],eax
  177.     8a 51 08                ; mov    dl,BYTE PTR [ecx+8]
  178.     88 d0                   ; mov    al,dl
  179.     c0 e8 04                ; shr    al,0x4

  180. BYTES_PATCH
  181.     88 d0                   ; mov    al,dl
  182.     c0 e8 04                ; shr    al,0x4
  183.     84 c0                   ; test   al,al
  184.     74 02                   ; jz     +2
  185.     30 c0                   ; xor    al,al
  186.     c3                      ; ret
  187.         *f86                ; ...skip...
  188.     8b 45 08                ; mov    eax,DWORD PTR [ebp+8]
  189.     8b 4d 08                ; mov    ecx,DWORD PTR [ebp+8]
  190.     8b 40 04                ; mov    eax,DWORD PTR [eax+4]
  191.     89 45 f8                ; mov    DWORD PTR [ebp-8],eax
  192.     8a 51 08                ; mov    dl,BYTE PTR [ecx+8]
  193.     e8 |-fa6                ; call patch


  194.     ; Linux i686

  195. BYTES_ORIGINAL
  196.     90 90 90 90 90 90       ; nops for the patch
  197.     90 90 90 90 90 90       ; nops for the patch
  198.         *3c7                ; ...skip...
  199.     8b 44 24 30             ; mov    eax,DWORD PTR [esp+48]
  200.     8b 78 04                ; mov    edi,DWORD PTR [eax+4]
  201.     8a 50 08                ; mov    dl,BYTE PTR [eax+8]
  202.     88 d0                   ; mov    al,dl
  203.     c0 e8 04                ; shr    al,0x4

  204. BYTES_PATCH
  205.     88 d0                   ; mov    al,dl
  206.     c0 e8 04                ; shr    al,0x4
  207.     84 c0                   ; test   al,al
  208.     74 02                   ; jz     +2
  209.     30 c0                   ; xor    al,al
  210.     c3                      ; ret
  211.         *3c7                ; ...skip...
  212.     8b 44 24 30             ; mov    eax,DWORD PTR [esp+48]
  213.     8b 78 04                ; mov    edi,DWORD PTR [eax+4]
  214.     8a 50 08                ; mov    dl,BYTE PTR [eax+8]
  215.     e8 |-3e2                ; call patch



复制代码
回复

使用道具 举报

发表于 2013-1-1 18:39:14 | 显示全部楼层 来自 山西太原
你的防炸能给我用用吗,能的话加我qq627251996,谢谢
回复

使用道具 举报

发表于 2013-1-1 19:08:18 | 显示全部楼层 来自 山东淄博
neverneverdead 发表于 2012-12-15 15:40
防范代码如下:

求炸中 一直 中
回复

使用道具 举报

 楼主| 发表于 2013-1-3 08:49:22 | 显示全部楼层 来自 吉林长春
css 发表于 2013-1-1 19:08
求炸中 一直 中

那个炸服的东西里炸服的方法太多了。。。哎。。。
现在就能防住Hl boom,然后加密码,才能防炸~
回复

使用道具 举报

发表于 2013-1-3 13:45:58 | 显示全部楼层 来自 广西
这是针对CS1.5的?
回复

使用道具 举报

 楼主| 发表于 2013-1-4 19:22:51 | 显示全部楼层 来自 吉林长春
cboby 发表于 2013-1-3 13:45
这是针对CS1.5的?

1.5 1.6  都有这问题
回复

使用道具 举报

发表于 2013-1-12 00:06:52 | 显示全部楼层 来自 广东茂名
回复

使用道具 举报

发表于 2013-2-9 12:03:27 | 显示全部楼层 来自 广西梧州
朋友,hlds fake炸服,能解决吗
回复

使用道具 举报

发表于 2013-2-9 12:55:22 | 显示全部楼层 来自 黑龙江大兴安岭地区加格达奇区
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表