China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-26 23:35
中国DOS联盟论坛 » 其它操作系统综合讨论区 » [Original] A Little-Known Secret (Internal Command) View 8,131 Replies 56
Original Poster Posted 2008-02-16 21:55 ·  中国 河北 邢台 电信
中级用户
★★
Credits 242
Posts 134
Joined 2006-12-11 15:14
19-year member
UID 73203
Gender Male
Status Offline
Original: A Little-Known Secret (Windows Command Processor Internal Command)

It's a long story. This secret was discovered by me as early as the pure DOS era (MS-DOS 6.22), and it's been more than ten years now.
I've been using this secret all the time, and I've been reluctant to disclose it. I'm a bit worried that disclosing it might cause chaos.
Strangely, no one else has discovered it over the years. Maybe it's a bit niche.

So, why am I disclosing this secret now?
Because some viruses have been using this double-edged sword to attack victims.

Deciding to disclose this secret is to stir up the pot, making it difficult for some viruses to operate.
This might also affect regular legal programs, but that's another topic.

Let's get to the main point. How to describe this?
Actually, the internal commands of the operating system's command interpreter CMD.EXE (it was previously called COMMAND.COM);
can also be "invalidated (effectively equivalent to deletion)" or "renamed".

This is the core of the secret I'm going to reveal to everyone.

So,
How to "invalidate" and "rename" the internal commands of the command interpreter?
What are the effects after "invalidating" and "renaming" the internal commands of the command interpreter? It's better to go backwards.

1. What are the effects after "invalidating" and "renaming" the internal commands of the command interpreter?
Regarding what internal commands and external commands are, to save space, I won't say much. Those who don't understand can refer to relevant materials.
However, it's best to come back when you understand this, otherwise you might get more confused.
The number of internal commands varies with different versions; usually, higher versions have more and stronger functions.
These internal commands provide great convenience for operators.

However, everything has two sides, and this duality sometimes shows as a double-edged sword nature.
The internal commands of the command interpreter are no exception, having a double-edged sword nature.
When they are legally used by operators, they are powerful tools and assistants.

But once these internal commands of the command interpreter are used by viruses, they become凶器, with unimaginable consequences.
Take an example:
rd /q /s C:\ is no different from format C:

Is it terrifying? Definitely not. Currently, there are countless examples of viruses directly or through scripts executing internal commands on the victim's machine; I have the right to speak on this point because my command interpreter has been modified by me for more than ten years. In my place, the virus scripts that failed to call the standard internal commands I wanted to call were intercepted in baskets and baskets.
Let's take another example, and only the virus author will be surprised when they see it, because normally you can't see these scripts in a normal system; they self-destruct after achieving their purpose.

@echo off
if not exist %SystemRoot%\system32\机器鼠.exe (今年流行机器鼠) copy mmouse.dat %SystemRoot%\system32\机器鼠.exe >nul
attrib +h %SystemRoot%\system32\机器鼠.exe >nul 2>nul
regedit /s mmouse.reg
del mouse.dat >nul
del mouse.reg >nul
:loop
del 0% >nul
if exist 0% goto loop

Generally, it's in this format. Among them, 机器鼠.exe is a metaphorical virus program (its predecessor is mmouse.dat)
In this virus script, the virus calls two internal commands: copy and del
In this virus script, the virus finally uses del 0% to self-destruct

First of all, it's a fact that the virus script can call any standard internal command here.
Can't it call the dangerous commands mentioned earlier:
rd /q /s C:\
rd /q /s D:\
rd /q /s E:\
............

The reason why such vicious viruses are not common at present;
One is that they haven't lost all their conscience.
Two... Here I would like to expound my other view;
Viruses can't be too powerful. The reason is actually very simple. A too powerful virus is equivalent to suicide.
Just imagine, as soon as you get infected, the machine is immediately formatted with high-level or low-level formatting, then, can such a powerful virus still survive?
Then it can't be called a virus anymore, and a new term must be created to describe this thing.

Let's get back to the topic. Then, the above virus is basically defeated in my place.
Because there are no copy del ren rd md... in my place.
Even the aliases earse rename rmdir mkdir... don't exist.
It can also be said that except for cd chdir path if rem I didn't change, almost everything else was changed, haha.

Can this virus not be defeated? It can't achieve the purpose of renaming and copying mmouse.dat to the destination.
It can't achieve the purpose of self-destruct traces either, so the script is also captured by me.

Summary of this paragraph:
If you don't understand CMD, then CMD is basically prepared for viruses. Now CMD doesn't play a good role in most machines, so it's suggested that such users disable CMD or delete CMD. There are many methods online.

If you understand CMD and still use it occasionally, then I suggest you also fix CMD.

I must tell you that if you do this, some programs that want to call CMD will not run.
However, the sovereignty is still in your hands. As long as you can respond flexibly, it's okay (see later, skills).
I can frankly tell you that the content introduced in this article will not have adverse side effects on the system.

2. How to "invalidate" and "rename" the internal commands of the command interpreter
I have modified COMMAND.COM of MS-DOS6.22
I have modified COMMAND.COM of Win98, WinMe
I once made Wininit.ini of Win98, WinMe invalid (very good anti-virus effect, no way to replace system files, still in use)
I even made AUTOEXEC.BAT not have this name (also very good anti-virus effect, still in use now)
I can also make Config.sys not have this name (not meaningful, very few viruses that make DOS driver programs)
I once completely invalidated dir /a

Let's get to the point quickly. Now it's the XP era, let's go straight to CMD.EXE, and it's easy to generalize for 9x.

First, copy a CMD.EXE to another place, then use a hex editor to open CMD.EXE
Go to the relative sector 0000406 area (if it's CMD.EXE of 2003, it's the relative sector 0000408),
Okay, all the internal commands are basically clearly displayed in front of you, for you to cut and repair.

Because XP's CMD.EXE (5.1.2600.2180) uses Unicode;
so, the keywords of these internal commands are all described with one letter separated by one 00 code,
If you want to invalidate a certain internal command, just change it all to 00
If you want to rename a certain internal command, it's up to you, but you need to change it in sections, and the length, case, etc. must not change.
After modification, save and exit.
As for how to replace the CMD.EXE in the system, I think anyone who wants to try has this ability, and I won't say more.

3. Incidental countermeasures (three types, each with its own characteristics)
Because after this operation, the standard internal commands are gone (excluding those you didn't change), in this case, no matter who;
you, third-party programs, viruses, etc., anyone who calls the standard internal command will get:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

X:\>xxx
'xxx' is not an internal or external command, nor is it a runnable program
or batch file.

X:\>

Countermeasure (one):
Don't do anything, just like this. The advantage is that anyone who secretly calls the internal command of CMD without your consent will be exposed.

Countermeasure (two)
Compile some scripts that accept and transfer, deceive or record the behavior of programs that call the internal commands of CMD.
Example: DEL.BAT (CMD)
@echo off
??? %1 %2 %3 %4 %5 %6 %7 %8 %9
echo.

rem ??? is the renamed del internal command (I don't know what you will change it to)

Countermeasure (three)
Compile some misleading and empty scripts, basically a silent hands-off type of processing, just don't want to see what flashes by.
Example: RD.BAT (CMD)
cls
exit

Here, the scripts mentioned in countermeasure (two) and countermeasure (three) mean that for each COM internal command you invalidate or rename, you should compile a script file with the same main name as the standard internal command,
and place these script files in WINDOWS\SYSTEM32 (for 9x, place them in WINDOWS\COMMAND).

In other words, whatever standard CMD internal command you make unusable, you should write a script file with the same name to replace it. This replacement is fake in function, just a name in vain, and is to avoid pop-up dialog boxes.

Skills
1. Make a backup of the unchanged CMD, and it can still be re-enabled when necessary.

2. If you encounter a script that really wants to execute but is blocked by this trick, you can re-edit this script,
replace the CMD internal command that you renamed and made unusable in the script file with the real command name you renamed.


Final words
If the virus is not of the type mentioned in this article, it's another matter. This also forces viruses to develop to a higher level, don't just want to succeed with a few simple script statements.

If the virus brings CMD by itself, it's another matter. This is very unlikely, and it's much more difficult.
You have to break through Windows file protection, you have to consider version issues; 9x, xp, 2003... are all different! Haha!

It's messed up, you want to del..., you want to rd..., there is no such command,
what has it been changed to? Guess it!

According to records, a certain version of Machine Dog also fell into this trap. Whether this dog is improved later or not is another matter.

In short, if this measure is widely adopted at present, it's not good news for quite a part of viruses,
you (referring to viruses) have to study more, have to improve more.
Floor 2 Posted 2008-02-16 22:52 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
To put it simply, for decompilation, basically those who can localize know how to do this
第一高手 第二高手

Floor 3 Posted 2008-02-17 00:53 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Originally posted by fastslz at 2008-2-16 10:52 PM:
To put it simply, it's decompilation. Basically, those who can localize know how to do this.


This is not decompilation. It's not that complicated. This is modifying the strings in the executable program.
Floor 4 Posted 2008-02-17 01:32 ·  中国 广东 深圳 联通
高级用户
★★★
Credits 972
Posts 420
Joined 2004-05-16 00:00
22-year member
UID 24467
Gender Male
Status Offline
Do I still have to disable SFC first? The cost is a bit high
平生进退如飙风
Floor 5 Posted 2008-02-18 00:05 ·  中国 贵州 贵阳 电信
初级用户
★★
Credits 153
Posts 63
Joined 2008-02-17 15:25
18-year member
UID 110834
Gender Male
Status Offline
Learn, thanks for sharing.
Floor 6 Posted 2008-02-18 01:40 ·  中国 安徽 滁州 电信
新手上路
Credits 10
Posts 5
Joined 2008-01-11 20:49
18-year member
UID 108340
Gender Male
Status Offline
It has a miraculous effect on dealing with fool-level viruses. ^_^ But I still admire the owner's idea.
Floor 7 Posted 2008-02-18 14:18 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Learned, not much use.
Didn't see many machines瘫痪because of this either.
Windows 一键还原
http://www.yjhy.com
Floor 8 Posted 2008-02-19 14:46 ·  中国 广东 深圳 电信
中级用户
★★
Credits 396
Posts 183
Joined 2007-12-23 06:24
18-year member
UID 106531
Gender Male
Status Offline
It is suggested that the original post be deleted immediately. Those who are learning are reading it, and the virus author is also reading it.
Floor 9 Posted 2008-03-09 23:31 ·  中国 山东 青岛 联通
初级用户
Credits 34
Posts 19
Joined 2007-01-25 15:46
19-year member
UID 77651
Gender Male
Status Offline
Learn, thank you for sharing.
Floor 10 Posted 2008-03-11 10:11 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 89
Posts 36
Joined 2007-12-20 15:37
18-year member
UID 106247
Gender Male
Status Offline
Reminds me of the scenes of modifying characters in programs using tools like PCTOOLS before
Floor 11 Posted 2008-03-14 06:06 ·  中国 上海 浦东新区 电信
初级用户
★★
Credits 177
Posts 85
Joined 2007-12-01 20:40
18-year member
UID 104378
Gender Male
Status Offline
Support
Floor 12 Posted 2008-03-20 00:12 ·  中国 北京 华为云
初级用户
Credits 71
Posts 34
Joined 2008-03-12 19:53
18-year member
UID 112775
Gender Male
Status Offline
Just this. Now viruses shouldn't be like this. Only those pranks would be like this, right?
Floor 13 Posted 2008-03-20 12:16 ·  中国 安徽 阜阳 联通
新手上路
Credits 7
Posts 3
Joined 2007-08-16 16:24
19-year member
UID 95260
Gender Male
Status Offline
Floor 14 Posted 2008-03-27 00:56 ·  中国 吉林 吉林市 电信
初级用户
夜语者
Credits 58
Posts 29
Joined 2007-04-22 11:37
19-year member
UID 86081
Gender Male
From 地狱十九重
Status Offline
It wasters such as level shaders a long time ago, probably around 1991 or so
冰我喜欢你


无论如何,坚守最后的良知!
thirteen.pdx.cn
Floor 15 Posted 2008-03-27 01:49 ·  中国 海南 海口 电信
初级用户
Credits 24
Posts 12
Joined 2006-03-17 02:12
20-year member
UID 52232
Status Offline
I did PCTOOLS and HD-COPY localization in 1996. Then I felt it was boring. Just replacing characters.
Forum Jump: