By Christopher Wells
Book Price: $49.99 USD
£30.99 GBP
PDF Price: $34.99
Cover | Table of Contents | Colophon
The Hypertext Transfer Protocol (HTTP) is an application-level protocol with the lightness and speed necessary for distributed, collaborative, hypermedia information systems. It is a generic, stateless, object-oriented protocol which can be used for many tasks, such as name servers and distributed object management systems, through extension of its request methods (commands). A feature of HTTP is the typing of data representation, allowing systems to be built independently of the data being transferred.HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification reflects common usage of the protocol referred to as "HTTP/1.0".
XMLHttpRequest object without a web server to talk to on the backend. So, Ajax Security starts with the web server. If your web server is not secure, neither is your application. You need to know what role the web server plays in security. Securing a web server is a non-trivial task that requires an understanding of the web server's relationship with the network. By being aware of what security measures are on the web server, you can balance the security necessary within your applications. In this chapter, I will look at how to ensure the network is secure, and then go through the steps for making a secure and dynamite web server. I will also address what to do in the event of an attack.
groupadd webadmin chgrp -R webadmin /etc/apache2 chgrp -R webadmin /var/apache2 chmod -R g+rw /etc/apache2 chmod -R g+r /var/log/apache2 usermod -G webadmin user1,user2
user = request.getParameter("user");
User = Request.getParameter("user");
$user = $_POST['user'];
<!-- Reflected XSS example -->
<%= request.getParameter("myVar"); %>
myVar. Here's an example of how a script might get injected using a link on a web page:
<a href=http://www.somesite.com/reflectedExample/index.html?myVar=<script>
alert('gotcha');</script>>Click here for your free iPhone!</a>
<!-- Persisted XSS example --> <% myVar = [VALUE FROM DATABASE]; %> <$= myVar %> <!-- value is output directly without encoding -->
{
"type": "Menu",
"value": "File",
"items": [
{"value": "New", "action": "CreateNewDocument"},
{"value": "Open", "action": "OpenDocument"},
{"value": "Save", "action": "SaveDocument"}
]
}
eval( ):
var myVar = eval( '(' + jsontext + ')' );
eval( ) function is a bit like setting a bull loose in a china shop, since eval( ) will blindly interpret everything in the JSON text with no security or validation checking, but boy is it fast. So, what's wrong with automatically hydrating this stuff? The most obvious attack is XSS. Consider what would happen if the code in were run through eval( ).
{
"name": "menu",
"value": "File",
"items": [
{"value": "New", "action": "CreateNewDocument"},
{"value": "Open", "action": "OpenDocument"},
{"value": "Save", "action": "SaveDocument"}
]
});alert('Gotcha!!'
text/html, the browser will render the JSON as if it were HTML—even if it's really just a JavaScript fragment. The easiest way to protect against this is to ensure that all JavaScript received by the
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting><script>alert('Gotcha!');</script></greeting>
title and entries, which can be headlines, full-text articles, links, summaries, or other content.
xml:base for relative URIs—providing the ability to distinguish between relative and nonrelative URIs.
xml:lang attribute rather than introduce its own proprietary language element.
Representational State Transfer (REST) is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.
HTTP GET, POST, PUT, DELETE).