the term magic number has multiple meanings. It could refer to one or more of the following:
- A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures
- Distinctive unique values that are unlikely to be mistaken for other meanings (e.g., Globally Unique Identifiers)
- Unique values with unexplained meaning or multiple occurrences which could (preferably) be replaced with named constants
Magic numbers are common in programs across many operating systems. Magic numbers implement strongly typed data and are a form of in-band signaling to the controlling program that reads the data type(s) at program run-time. Many files have such constants that identify the contained data. Detecting such constants in files is a simple and effective way of distinguishing between many file formats and can yield further run-time information.
Magic numbers in protocols :
- The OSCAR protocol, used in AIM/ICQ, prefixes requests with
2A
. - In the RFB protocol used by VNC, a client starts its conversation with a server by sending "RFB" (
52
46
42
, for "Remote Frame Buffer") followed by the client's protocol version number. - In the SMB protocol used by Microsoft Windows, each SMB request or server reply begins with '
FF
53
4D
42
', or"\xFFSMB"
at the start of the SMB request. - In the MSRPC protocol used by Microsoft Windows, each TCP-based request begins with
05
at the start of the request (representing Microsoft DCE/RPC Version 5), followed immediately by a00
or01
for the minor version. In UDP-based MSRPC requests the first byte is always04
. - In COM and DCOM marshalled interfaces, called OBJREFs, always start with the byte sequence "MEOW" (
4D
45
4F
57
). Debugging extensions (used for DCOM channel hooking) are prefaced with the byte sequence "MARB" (4D
41
52
42
). - Unencrypted BitTorrent tracker requests begin with a single byte containing the value
19
representing the header length, followed immediately by the phrase "BitTorrent protocol" at byte position 1. - eDonkey2000/eMule traffic begins with a single byte representing the client version. Currently
E3
represents an eDonkey client,C5
represents eMule, andD4
represents compressed eMule. - SSL
transactions always begin with a "client hello" message. The record
encapsulation scheme used to prefix all SSL packets consists of two- and
three- byte header forms. Typically an SSL version 2 client hello
message is prefixed with a
80
and an SSLv3 server response to a client hello begins with16
(though this may vary). - DHCP packets use a "magic cookie" value of '
0x63
0x82
0x53
0x63
' at the start of the options section of the packet. This value is included in all DHCP packet types.
Tidak ada komentar:
Posting Komentar