Pages

Monday, June 30, 2008

Introduction to XML

XML was designed to transport and store data.
HTML was designed to display data.

What You Should Already Know
Before you continue you should have a basic understanding of the following:
HTML and JavaScript

What is XML?
XML stands for EXtensible Markup Language
XML is a markup language much like HTML
XML was designed to carry data, not to display data
XML tags are not predefined. You must define your own tags
XML is designed to be self-descriptive
XML is a W3C Recommendation

The Difference Between XML and HTML
XML is not a replacement for HTML.
XML and HTML were designed with different goals:
XML was designed to transport and store data, with focus on what data is
HTML was designed to display data, with focus on how data looks
HTML is about displaying information, while XML is about carrying information.

XML Does Not DO Anything
Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information.

The note above is quite self descriptive. It has sender and receiver information, it also has a heading and a message body.
But still, this XML document does not DO anything. It is just information wrapped in tags. Someone must write a piece of software to send, receive or display it.

With XML You Invent Your Own Tags
The tags in the example above (like and ) are not defined in any XML standard. These tags are "invented" by the author of the XML document.
That is because the XML language has no predefined tags.
The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like

,

, etc.).
XML allows the author to define his/her own tags and his/her own document structure.

XML is Not a Replacement for HTML
XML is a complement to HTML.
It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data.

My best description of XML is this:
XML is a software- and hardware-independent tool for carrying information.
XML is a W3C Recommendation
XML became a W3C Recommendation 10. February 1998.

XML is Everywhere
XML is now as important for the Web as HTML was to the foundation of the Web.
XML is the most common tool for data transmissions between all sorts of applications.

Saturday, June 21, 2008

Cross-site Scripting (XSS)

Overview
Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. Cross-site scripting (XSS) attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user in the output it generates without validating or encoding it.
An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.

Description
Cross-Site Scripting (XSS) attacks occur when:
Data enters a Web application through an untrusted source, most frequently a web request.
The data is included in dynamic content that is sent to a web user without being validated for malicious code.
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.

Stored and Reflected XSS Attacks
XSS attacks can generally be categorized into two categories: stored and reflected. There is a third, much less well known type of XSS attack called DOM Based XSS that is discussed seperately here.

Stored XSS Attacks
Stored attacks are those where the injected code is permanently stored on the target servers, such as in a database, in a message forum, visitor log, comment field, etc. The victim then retrieves the malicious script from the server when it requests the stored information.

Reflected XSS Attacks
Reflected attacks are those where the injected code is reflected off the web server, such as in an error message, search result, or any other response that includes some or all of the input sent to the server as part of the request. Reflected attacks are delivered to victims via another route, such as in an e-mail message, or on some other web server. When a user is tricked into clicking on a malicious link or submitting a specially crafted form, the injected code travels to the vulnerable web server, which reflects the attack back to the user’s browser. The browser then executes the code because it came from a "trusted" server.

XSS Attack Consequences
The consequence of an XSS attack is the same regardless of whether it is stored or reflected (or DOM Based). The difference is in how the payload arrives at the server. Do not be fooled into thinking that a “read only” or “brochureware” site is not vulnerable to serious reflected XSS attacks. XSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise. The most severe XSS attacks involve disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account. Other damaging attacks include the disclosure of end user files, installation of Trojan horse programs, redirect the user to some other page or site, or modify presentation of content. An XSS vulnerability allowing an attacker to modify a press release or news item could affect a company’s stock price or lessen consumer confidence. An XSS vulnerability on a pharmaceutical site could allow an attacker to modify dosage information resulting in an overdose.

How to Determine If You Are Vulnerable
XSS flaws can be difficult to identify and remove from a web application. The best way to find flaws is to perform a security review of the code and search for all places where input from an HTTP request could possibly make its way into the HTML output. Note that a variety of different HTML tags can be used to transmit a malicious JavaScript. Nessus, Nikto, and some other available tools can help scan a website for these flaws, but can only scratch the surface. If one part of a website is vulnerable, there is a high likelihood that there are other problems as well.

Thursday, June 19, 2008

Cryptography

Cryptography (or cryptology; "hidden, secret"; and graph, "writing", respectively) is the practice and study of hiding information. Modern cryptography intersects the disciplines of mathematics, computer science, and engineering. Applications of cryptography include ATM cards, computer passwords, and electronic commerce.
Cryptology prior to the modern age was almost synonymous with encryption, the conversion of information from a readable state to nonsense. The sender retained the ability to decrypt the information and therefore avoid unwanted persons being able to read it. Since WWI and the advent of the computer, the methods used to carry out cryptology have become increasingly complex and its application more widespread.
Alongside the advancement in cryptology-related technology, the practice has raised a number of legal issues, some of which remain unresolved.



Terminology

Until modern times cryptography referred almost exclusively to encryption, which is the process of converting ordinary information (plaintext) into unintelligible gibberish (i.e., ciphertext). Decryption is the reverse, in other words, moving from the unintelligible ciphertext back to plaintext. A cipher (or cypher) is a pair of algorithms that create the encryption and the reversing decryption. The detailed operation of a cipher is controlled both by the algorithm and in each instance by a key. This is a secret parameter (ideally known only to the communicants) for a specific message exchange context. Keys are important, as ciphers without variable keys can be trivially broken with only the knowledge of the cipher used and are therefore useless (or even counter-productive) for most purposes. Historically, ciphers were often used directly for encryption or decryption without additional procedures such as authentication or integrity checks.
In colloquial use, the term "code" is often used to mean any method of encryption or concealment of meaning. However, in cryptography, code has a more specific meaning. It means the replacement of a unit of plaintext (i.e., a meaningful word or phrase) with a code word (for example, wallaby replaces attack at dawn). Codes are no longer used in serious cryptography—except incidentally for such things as unit designations (e.g., Bronco Flight or Operation Overlord)—since properly chosen ciphers are both more practical and more secure than even the best codes and also are better adapted to computers.
Cryptanalysis is the term used for the study of methods for obtaining the meaning of encrypted information without access to the key normally required to do so; i.e., it is the study of how to crack encryption algorithms or their implementations.
Some use the terms cryptography and cryptology interchangeably in English, while others (including US military practice generally) use cryptography to refer specifically to the use and practice of cryptographic techniques and cryptology to refer to the combined study of cryptography and cryptanalysis. English is more flexible than several other languages in which cryptology (done by cryptologists) is always used in the second sense above. In the English Wikipedia the general term used for the entire field is cryptography (done by cryptographers).
The study of characteristics of languages which have some application in cryptography (or cryptology), i.e. frequency data, letter combinations, universal patterns, etc., is called cryptolinguistics.

Wednesday, June 18, 2008

Toad (Mario)

Toad – known in Japan as Kinopio (キノピオ?) – is a fictional, anthropomorphic mushroom in the Mario series, created by Shigeru Miyamoto. A citizen of the Mushroom Kingdom, Toad is one of Princess Peach's most loyal servants and is constantly working on her behalf. He is usually seen as a non-player character (NPC) who provides assistance to Mario and his friends in most games, but there are times when Toad takes center stage and appears as a protagonist, as seen in Super Mario Bros. 2 and Wario's Woods.
Toad's original role as a helper has been increasingly taken over by Toadsworth, causing Toad to appear less frequently than he once had in the main series; however, recently in New Super Mario Bros. Wii, two Toads (Yellow and Blue) appear as playable characters along with Mario and Luigi.

Concept and creation
Toad and the Toad species were first seen in the game Super Mario Bros. where the species was revealed to comprise the majority of the population of the Mushroom Kingdom. Toad's design was made directly from the power up, the Super Mushroom as well as the game's general association with mushrooms. In the game, the peaceful Toads of the Mushroom Kingdom had been turned into various objects such as bricks and pipes by the evil King Bowser; however, some of Princess Toadstool's loyal servants, known as the "Mushroom Retainers" were simply kidnapped.
During the development of New Super Mario Bros. Wii, the developers at Nintendo decided between four characters to be playable in the game: Princess Peach, Toad, Wario and Waluigi (all suggestions made by fans). Two Toads (Yellow and Blue) were eventually included as playable characters in New Super Mario Bros. Wii due to their physical similarity to Mario and Luigi.

Characteristics
Toad bears a similar appearance to the rest of his species with his large mushroom cap and clothes. He is extremely small in size, and has no legs visible, with just his shoes showing. Unlike other Toads, he features red polka dots on his mushroom head and wears a blue waistcoat; however, his coloration will change if he gets a fire flower, as his cap's colors will be reversed while his clothes turn red. A yellow outline was added to his blue vest in the recent Mario games starting from Mario Kart Double Dash. Sometimes, Toad appears with a red vest, though he is most often seen with his blue vest.
In the Mario cartoons, Toad has on occasion removed his mushroom cap, revealing three strands of hair; however, the games have never confirmed or refuted this. Toad appears as a mix between a mushroom and a rather small human. However, Toad can grow to about a normal human's height if he consumes a Super Mushroom, as seen in Super Mario Bros. 2 and New Super Mario Bros. Wii.
At most times, Toad is portrayed as a rather cowardly character, but the fact that he actually knows about his cowardice makes him one of the more innocent and humbler characters in the series. Despite his fears, Toad is usually one of the few people that tries his best to support Mario when he is on his adventures, from providing items to actually going along with the hero on his quest. Despite the fact that Toad is usually seen as a cheerful character, he can get extremely distressed when a major event occurs, such as the kidnapping of the Princess.

Abilities
Through the various games that Toad is playable in, he has been shown with different unique abilities that differ from the other characters in the series. In Super Mario Bros. 2, he has a combination of being the strongest and fastest character in the game with 5 out of 5 stars each. However, he has horrible jumping ability (rated at 2 out of 5 stars). In Wario's Woods, Toad has the unique ability to run up walls and give strong kicks as well. Toad is once again given superhuman strength in the game, as he was able to lift and throw enemies around; however, these abilities have not been seen since this game. In New Super Mario Bros. Wii, Toad shares many of the moves and abilities that Mario and Luigi are able to use such as the ground pound and wall jumping. He has access to Mario's Power ups, but unlike the other games Toad has starred in, this game gives him all round stats (such as average jumps instead of weak ones) similar to the Mario Bros. His signature ability to pick up, carry and throw large items (such as barrels) and other characters via his superhuman strength also returns in the game.
In the Super Smash Bros. series, Toad is shown to emit spores like real mushrooms whenever he is attacked as shown when Peach uses her standard special move. However, this has never been actually seen in the main Mario series games.