Web Development: A Comparison of Three Major Platforms

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου
A comprehensive look at Linux / Apache / MySQL / PHP (LAMP) vs. Microsoft’s ASP.NET vs. Sun’s Java 2 Enterprise Edition (J2EE)

Area

LAMP

ASP.NET

J2EE

Licensing cost

  • No licensing cost
  • Expensive licensing cost
  • No licensing cost

Support options and cost

  • Free support via community
  • Paid support options available
  • Free support via community
  • Paid support options available
  • Free support via community
  • Paid support options available

Platform(s)

  • Multiple
  • Windows only
  • Multiple

Hardware

Costs

  • Runs on very inexpensive servers
  • Requires slightly more expensive servers
  • Requires expensive servers

Staffing

  • Somewhat difficult to find qualified people
  • Very easy to find qualified people
  • Reasonably easy to find qualified people

External Hosting

  • Widely available and inexpensive
  • Widely available, but more expensive
  • Not widely available

Security

  • Very good
  • Historically very bad, but improved recently
  • Good

Performance

  • Very good
  • Often requires more expensive hardware to perform well
  • Often requires substantial configuration and expensive hardware

Scalability

  • Scales very well
  • Can be difficult to scale
  • Scales well when configured properly

Administration

  • Difficult: Often requires reading documentation and editing text files
  • Easy: Often can be done through point and click interface
  • Moderate: Sometimes can be done visually

Configuration

ease of use

  • Can be difficult to configure properly
  • Easy to configure
  • Moderately difficult to configure

Configuration flexibility

  • Extremely flexible
  • Not very flexible
  • Moderately flexible

Framework(s)

  • Many available – often difficult to choose
  • One standardized framework
  • One standardized framework

Components

  • Widely available
  • Widely available
  • Widely available

Compatibility

  • Very good: New versions usually backwards-compatible
  • Moderate: New versions often break functionality
  • Bad: Many problems between old and new versions

Web Development Technologies

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου

The following is a guide to some of the main web technologies we use to develop accessible, W3C standards-compliant web sites. 

Client-Side Technologies

XHTML
XHTML is a markup language designed to structure information for presentation as web pages. Rather than relying on WYSIWYG programs, we write all our XHTML by hand, ensuring that it is clean, valid and of the highest standard. This means that pages have fastest download times possible, are viewable on all browsers, are search engine friendly, and have maximum forward compatibility.
Cascading Style Sheets
Cascading Style Sheets control how web pages are displayed in the browser, and allow the separation of presentation from structure and content. CSS help ensure that web pages are presented in an accessible way to all visitors, over a wide range of media.
JavaScript/ECMA Script
JavaScript is a lightweight scripting technology which is used alongside XHTML documents to make websites more interactive.

Server-Side Technologies

PHP
PHP is a fast, server-side scripting language that is used to create interactive, dynamic web sites. It is particularly well-suited to integrating with a range of databases.
CGI/Perl
Perl is a programming language that can handle input and output from a Web Server, usually through the Common Gateway Interface. It is most commonly used to process information through forms.
XML/XSL
XML is a software and hardware independent markup language designed for describing and transmitting information. It is set to become the most common tool for all data manipulation and data transmission. XSL is a language for defining, transforming and formatting XML documents.
MySQL
MySQL is a fast, open-source Relational Database Management System that uses the popular Structured Query Language (SQL). It is perfect for most websites that need database functionality, and works hand-in-hand with PHP.
PostgreSQL
PostgreSQL is a more sophisticated open-source Relational Database Management System. It is well-suited to sites that require robust database functionality, such as e-commerce sites.
Linux/Apache
Linux is a popular open-source operating system, and Apache is the most widely-used web server on the Internet. Together they provide a fast, extremely reliable, secure platform for web sites.
SSL/Secure Servers
Unlike normal web servers, secure servers ensure that information exchanged between the visitor and the web site cannot be viewed by any third parties. A secure server is essential when handling confidential information, such as online credit card transactions or personal medical details. SSL, or Secure Socket Layer, is one method of exchanging data securely.

Multimedia

Macromedia Flash
Flash is a product designed to provide web sites with animation, sound, interactivity and database integration. A free plugin, which also ships with the major web browsers, is needed to see the Flash parts of a site. Flash can create a truly multimedia web site, but has certain disadvantages, and is therefore best used sparingly.

We also have experience with a range of other technologies, including ASP, Microsoft Access, SQL Server, Windows, IIS, SSI and Macromedia Shockwave/Director.

SQL Injection Attacks and Some Tips on How to Prevent Them

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου
Discusses various aspects of SQL Injection attacks, what to look for in your code, and how to secure it against SQL Injection attacks.

Introduction

Security in software applications is an ever more important topic. In this article, I discuss various aspects of SQL Injection attacks, what to look for in your code, and how to secure it against SQL Injection attacks. Although the technologies used here are SQL Server 2000 and the .NET Framework, the general ideas presented apply to any modern data driven application framework, which makes attacks potentially possible on any type of application that depends on that framework.

What is a SQL Injection Attack?

A SQL Injection attack is a form of attack that comes from user input that has not been checked to see that it is valid. The objective is to fool the database system into running malicious code that will reveal sensitive information or otherwise compromise the server.

There are two main types of attacks. First-order attacks are when the attacker receives the desired result immediately, either by direct response from the application they are interacting with or some other response mechanism, such as email. Second-order attacks are when the attacker injects some data that will reside in the database, but the payload will not be immediately activated. I will discuss each in more detail later in this article.

An example of what an attacker might do

In the following example, assume that a web site is being used to mount an attack on the database. If you think about a typical SQL statement, you might think of something like:

Collapse
SELECT ProductName, QuantityPerUnit, UnitPrice 
FROM Products 
WHERE ProductName LIKE 'G%'

The objective of the attacker is to inject their own SQL into the statement that the application will use to query the database. If, for instance, the above query was generated from a search feature on a web site, then they user may have inserted the "G" as their query. If the server side code then inserts the user input directly into the SQL statement, it might look like this:

Collapse
string sql = "SELECT ProductName, QuantityPerUnit, UnitPrice "+
    "FROM Products " +
    "WHERE ProductName LIKE '"+this.search.Text+"%';
SqlDataAdapter da = new SqlDataAdapter(sql, DbCommand);
da.Fill(productDataSet);

This is all fine if the data is valid, but what if the user types something unexpected? What happens if the user types:

Collapse
' UNION SELECT name, type, id FROM sysobjects;--

Note the initial apostrophe; it closes the opening quote in the original SQL statement. Also, note the two dashes at the end; that starts a comment, which means that anything left in the original SQL statement is ignored.

Now, when the attacker views the page that was meant to list the products the user has searched for, they get a list of all the names of all the objects in the database and the type of object that they are. From this list, the attacker can see that there is a table called Users. If they take note of the id for the Users table, they could then inject the following:

Collapse
' UNION SELECT name, '', length FROM syscolumns 
WHERE id = 1845581613;--

This would give them a list of the column names in the Users table. Now they have enough information to get access to a list of users, passwords, and if they have admin privileges on the web site.

Collapse
' UNION SELECT UserName, Password, IsAdmin FROM Users;--

Assume that there is a table called Users which has columns called UserName and Password, it is possible to union that with the original query and the results will be interpreted as if the UserName was the name of the product and the Password was the quantity per unit. Finally, because the attacker discovered that there is a IsAdmin column, they are likely to retrieve the information in that too.

Locking down

Security is something that needs to be tackled on many levels because a chain is only as strong as its weakest link. When a user interacts with a piece of software, there are many links in the chain; if the user is malicious, he could attempt to attack these links to find the weak point and attempt to break the system at that point. With this in mind, it is important that the developer does not become complacent about the security of the system because one security measure is put in place, or a set of security measures are in place on only one part of the system.

An intranet website that uses Windows authentication (it takes the user's existing credentials based on who they are logged in as) and is sitting inside the corporate network and unavailable to Internet users may give the impression that only authorised users can access the intranet web application. However, it is possible for an authenticated user to gain unauthorised access if the security is not taken much beyond that level. Some statistics support the suggestion that most security breaches are insider jobs rather than people attacking the system from outside.

With this in mind, it is important that even if the application permits only valid data through that has been carefully verified and cleaned up, other security measures are put in place. This is especially important between application layers where there may be an increased opportunity for spoofing of requests or results.

For example, if a web application were to request that the user choose a date, then it would be normal that the values for the date are checked in some JavaScript function on the web page before any data was posted back to the server. This improves the user experience by reducing the wait between lots of server requests. However, the value needs to be validated again on the server as it is possible to spoof the request with a deliberately crafted invalid date.

Encrypting data

Starting from the proposition that somehow an attacker has managed to break through all other defenses, what information is so sensitive that it needs to remain a secret? Candidates for encryption include user log in details or financial information such as credit card details.

For items such as passwords, the user's password can be stored as a "salted hash". What happens is that when a user creates a password, a randomly generated "salt" value is created by the application and appended to the password, and the password-and-salt are then passed through a one way encryption routine, such as found in the .NET Framework's helper class FormsAuthentication (HashPasswordForStoringInConfigFile method). The result is a salted hash which is stored in the database along with the clear text salt string.

The value of a salted hash is such that a dictionary attack is not going to work as each dictionary would have to be rebuilt appending the various salt values and recomputing the hash values for each item. While it is still possible to determine the password by brute force, the use of the salt (even though it is known) greatly slows down the process. The second advantage of the salt is that it masks any situations where two independent users happen to use the same password, as the salted hash value for each user would be different if given different salt values.

Least Privilege - Database account

Running an application that connects to the database using the database's administrator account has the potential for an attacker to perform almost limitless commands with the database. Anything an administrator can do, so can an attacker.

Using the example application above, an attacker could inject the following to discover the contents of the hard disk(s) on the server.

The first command is used to create a temporary store on the database and fill it with some data. The following injected code will create a table with the same structure as the result set of the extended stored procedure that will be called. It then populates the table with the results of the extended stored procedure.

Collapse
'; CREATE TABLE haxor(name varchar(255), mb_free int); 
INSERT INTO haxor  EXEC master..xp_fixeddrives;--

A second injection attack has to take place in order to get the data out again.

Collapse
' UNION SELECT name, cast((mb_free) as varchar(10)), 1.0 FROM haxor;--

This returns the name of the disks with the available capacity in megabytes. Now that the drive letters of the disks are known, a new injection attack can take place in order to find out what is on those disks.

Collapse
'; DROP TABLE haxor;CREATE TABLE haxor(line varchar(255) null); 
INSERT INTO haxor EXEC master..xp_cmdshell 'dir /s c:\';--

And again, a second injection attack is used to get the data out again.

Collapse
' UNION SELECT line, '', 1.0 FROM haxor;-- 

xp_cmdshell, by default, is only executable by a user with the sysadmin privilege, such as sa, and CREATE TABLE is only available to sysadmin,db_dbowner or db_dlladmin users. It is therefore important to run the application with the least privileges that are necessary in order to perform the necessary functions of the application.

Least Privilege - Process account

When an instance of SQL Server is installed on a computer, it creates a service that runs in the background and processes the commands from applications that are connected to it. By default, this service is installed to use the Local System account. This is the most powerful account on a Windows machine, it is even more powerful than the Administrator account.

If an attacker has an opportunity to break out of the confines of SQL Server itself, such as through the extended procedure xp_cmdshell, then they could gain unrestricted access to the machine that the SQL Server is on.

Microsoft recommends that during the installation of SQL Server, the service is given a domain account which has the permissions set to only the necessary resources. That way, an attacker is confined by the permission set needed to run SQL Server.

Cleaning and Validating input

In many applications, the developer has side-stepped the potential use of the apostrophe as a way to get access to the system by performing a string replace on the input given by the user. This is useful for valid reasons, such as being able to enter surnames such as "O'Brian" or "D'Arcy", and so the developer may not even realise that they have partly defeated a SQL injection attack. For example:

Collapse
string surname = this.surnameTb.Text.Replace("'", "''");
string sql = "Update Users SET Surname='"+surname+"' "+
    "WHERE id="+userID;

All of the previous injection attack examples would cease to work given a scenario like this.

However, many applications need the user to enter numbers and these don't need to have the apostrophes escaped like a text string. If an application allows the user to review their orders by year, the application may execute some SQL like this:

Collapse
SELECT * FROM Orders WHERE DATEPART(YEAR, OrderDate) = 1996

And in order for the application to execute it, the C# code to build the SQL command might look like this:

Collapse
string sql = "SELECT * FROM Orders WHERE DATEPART(YEAR, OrderDate) = "+
    this.orderYearTb.Text);

It becomes easy to inject code into the database again. All the attackers need to do in this instance is start their attack with a number, then they inject the code they want to run. Like this:

Collapse
0; DELETE FROM Orders WHERE ID = 'competitor';--

It is therefore imperative that the input from the user is checked to determine that it really is a number, and in the valid range. For instance:

Collapse
string stringValue = orderYearTb.Text;
Regex re = new Regex(@"\D");
Match m = re.Match(someTextBox.Text);
if (m.Success)
{
    // This is NOT a number, do error processing.

}
else
{
    int intValue = int.Parse(stringValue);
    if ((intValue < 1990) || (intValue > DateTime.Now.Year))
    {
        // This is out of range, do error processing.

    }
}

Second-Order Attacks

A second-order attack is one where the data lies dormant in the database until some future event occurs. It often happens because once data is in the database, it is often thought of as being clean and is not checked again. However, the data is frequently used in queries where it can still cause harm.

Consider an application that permits the users to set up some favourite search criteria. When the user defines the search parameters, the application escapes out all the apostrophes so that a first-order attack cannot occur when the data for the favourite is inserted into the database. However, when the user comes to perform the search, the data is taken from the database and used to form a second query which then performs the actual search. It is this second query which is the victim of the attack.

For example. If the user types the following as the search criteria:

Collapse
'; DELETE Orders;--

The application takes this input and escapes out apostrophe so that the final SQL statement might look like this:

Collapse
INSERT Favourites (UserID, FriendlyName, Criteria)
VALUES(123, 'My Attack', ''';DELETE Orders;--')

which is entered into the database without problems. However, when the user selects their favourite search, the data is retrieved to the application, which forms a new SQL command and executes that. For example, the C# code might look like:

Collapse
// Get the valid user name and friendly name of the favourite

int uid = this.GetUserID();
string friendlyName = this.GetFriendlyName();

// Create the SQL statement to retrieve the search criteria

string sql = string.Format("SELECT Criteria FROM Favourites "+
    "WHERE UserID={0} AND FriendlyName='{1}'",
    uid, friendlyName);
SqlCommand cmd = new SqlCommand(sql, this.Connection);
string criteria = cmd.ExecuteScalar();

// Do the search

sql = string.Format("SELECT * FROM Products WHERE ProductName = '{0}'",
    criteria);
SqlDataAdapter da = new SqlDataAdapter(sql, this.Connection);
da.Fill(this.productDataSet);

The second query to the database, when fully expanded, now looks like this:

Collapse
SELECT * FROM Products WHERE ProductName = ''; DELETE Orders;--

It will return no results for the expected query, but the company has just lost all of their orders.

Parameterised Queries

SQL Server, like many database systems, supports a concept called parameterised queries. This is where the SQL Command uses a parameter instead of injecting the values directly into the command. The particular second-order attack above would not have been possible if parameterised queries had been used.

Where the application developer would have constructed a SqlCommand object like this:

Collapse
string cmdText=string.Format("SELECT * FROM Customers "+
    "WHERE Country='{0}'", countryName);
SqlCommand cmd = new SqlCommand(cmdText, conn);

A parameterised query would look like this:

Collapse
string commandText = "SELECT * FROM Customers "+
    "WHERE Country=@CountryName";
SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.Parameters.Add("@CountryName",countryName);

The value is replaced by a placeholder, the parameter, and then the parameter's value is added to the Parameters collection on the command.

While many second-order attacks can be prevented by using parameters, they can only be used in places were a parameter is permitted in the SQL statement. The application may return a variable sized result set based on user preference. The SQL statement would include the TOP keyword in order to limit the result set, however, in SQL Server 2000, TOP can only accept literal values so the application would have to inject that value into the SQL command to obtain that functionality. For example:

Collapse
string sql = string.Format("SELECT TOP {0} * FROM Products", numResults);

Using Stored Procedures

Stored Procedures add an extra layer of abstraction in to the design of a software system. This means that, so long as the interface on the stored procedure stays the same, the underlying table structure can change with no noticeable consequence to the application that is using the database. This layer of abstraction also helps put up an extra barrier to potential attackers. If access to the data in SQL Server is only ever permitted via stored procedures, then permission does not need to be explicitly set on any of the tables. Therefore, none of the tables should ever need to be exposed directly to outside applications. For an outside application to read or modify the database, it must go through stored procedures. Even though some stored procedures, if used incorrectly, could potentially damage the database, anything that can reduce the attack surface is beneficial.

Stored procedures can be written to validate any input that is sent to them to ensure the integrity of the data beyond the simple constraints otherwise available on the tables. Parameters can be checked for valid ranges. Information can be cross checked with data in other tables.

For example, consider a database that has the user details for a website, this includes the user name and password. It is important that an attacker is unable to get a list of passwords or even one password. The stored procedures are designed so that a password can be passed in, but it will never put a password in any result set. The stored procedures for registering and authenticating a user for the website might be:

  • RegisterUser
  • VerifyCredentials
  • ChangePassword

RegisterUser takes the user name and password as parameters (possibly along with other information that is necessary for registering on the website) and returns the UserID.

VerifyCredentials would be used for logging into the site by accepting the user name and the password. If there is a match the UserID is returned, if not then a NULL value.

ChangePassword would take the UserID, the old password and the new password. If the UserID and the password match, the password can be changed. A value that indicates success or failure is returned.

The above example shows that the password is always contained in the database and is never exposed.

Stored Procedure Caveat

While stored procedures seem to be a wonderful panacea against injection attacks, this is not necessarily the case. As mentioned above, it is important to validate data to check that it is correct and it is a definite benefit of stored procedures that they can do this; however, it is doubly important to validate data if the stored procedure is going to use EXEC(some_string) where some_string is built up from data and string literals to form a new command.

For instance, if the stored procedure is to modify the data model of the database, such as creating a table, the code may be written as follows:

Collapse
CREATE PROCEDURE dbo.CreateUserTable
    @userName sysname
AS
    EXEC('CREATE TABLE '+@userName+
        ' (column1 varchar(100), column2 varchar(100))');
GO

It is obvious that whatever @userName contains will be appended to the CREATE statement. An attacker could inject into the application some code that sets the user name to be:

Collapse
a(c1 int); SHUTDOWN WITH NOWAIT;--

which will immediately stop the SQL Server without waiting for other requests to complete.

It is important to validate the input to ensure that no illegal characters are present. The application could be set to ensure that spaces are not permitted as part of the user name and this could be rejected before it ever got as far as constructing the CREATE statement.

If the stored procedure is going to construct a SQL command based on an existing object, such as a table or view, then it should check that such an object exists. For instance:

Collapse
CREATE PROCEDURE dbo.AlterUserTable
    @userName sysname
AS
    IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_SCHEMA = 'dbo'
        AND TABLE_TYPE = 'BASE TABLE'
        AND TABLE_NAME = @userName)
    BEGIN
        // The table is known to exist
        // construct the appropriate command here
    END
GO

Error Messages

Error messages are useful to an attacker because they give additional information about the database that might not otherwise be available. It is often thought of as being helpful for the application to return an error message to the user if something goes wrong so that if the problem persists they have some useful information to tell the technical support team. Applications will often have some code that looks like this:

Collapse
try
{
    // Attempt some database operation

}
catch(Exception e)
{
    errorLabel.Text = string.Concat("Sorry, your request failed. ",
        "If the problem persists please report the following message ",
        "to technical support", Environment.Newline, e.Message);
}

A better solution that does not compromise security would be to display a generic error message that simply states an error has occurred with a unique ID. The unique ID means nothing to the user, but it will be logged along with the actual error diagnostics on the server which the technical support team has access to. The code above would change to something like this instead:

Collapse
try
{
    // Attempt some database operation

}
catch(Exception e)
{
    int id = ErrorLogger.LogException(e);
    errorLabel.Text = string.Format("Sorry, your request Failed. "+
        "If the problem persists please report error code {0} "
        "to the technical support team.", id);
}

Summary

  • Encrypt sensitive data.
  • Access the database using an account with the least privileges necessary.
  • Install the database using an account with the least privileges necessary.
  • Ensure that data is valid.
  • Do a code review to check for the possibility of second-order attacks.
  • Use parameterised queries.
  • Use stored procedures.
  • Re-validate data in stored procedures.
  • Ensure that error messages give nothing away about the internal architecture of the application or the database.

References

source: http://www.codeproject.com/KB/database/SqlInjectionAttacks.aspx

Embedded Passwords: Dangerous by Default

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου
Embedded Passwords: Dangerous by Default

Devices ranging from home wireless routers to printers to major industrial systems often use hard-coded passwords and embedded credentials -- built-in usernames and passwords that are sometimes publicly known. In some cases, admins close up these potential security holes by manually changing the credentials, but other times the step is overlooked. And in a few cases, it's not even possible.

The security community was horrified when it learned about Stuxnet, the worm designed to eat into industrial control systems, or SCADA systems, that was purportedly targeted at Iran's Bushehr nuclear reactor.

Not only was the worm highly sophisticated, but it also targeted a SCADA system fromSiemens (NYSE: SI) whose embedded password was well known.

Hard-coded passwords and embedded credentials are "extremely pervasive," being found in "everything from embedded systems such as printers, mobile and wireless devices, to databases to major applications like SAP (NYSE: SAP) or Oracle's (Nasdaq: ORCL) PeopleSoft," Stuart McClure, senior vice president of risk and compliance at McAfee, told TechNewsWorld.

Default passwords, which are included in everything from routers to software, can and should be changed, although many users don't do so. The most common example of this is wireless routers, most of which offer no security at all unless users actively change their default passwords.

"Administrators sometimes neglect to change default passwords due to fear of breaking things and creating more work for themselves," McClure said.

So why would anyone include default passwords in their products?

Having a default password makes it easy to install large numbers of devices, Russell Smoak, director of security research and operations at Cisco Systems (Nasdaq: CSCO), told TechNewsWorld. Further, default passwords allow untrusted suppliers to install large numbers of devices or do pre-staging because the passwords can later be changed, Smoak said.

Hard-coded passwords, however, cannot be changed by system administrators. They can be a "significant security risk," Smoak pointed out. "They reduce the security posture and expose devices to illicit access," he explained. 

Outlining the Threat

"Using embedded credentials secures apps from regular system users to some degree, but it's like closing your door but leaving it unlocked," Al Hilwa, a program director at IDC, told TechNewsWorld. "Unless there are ways to obfuscate code in a secure way, embedded credentials will be readable by anyone who has access to the code."

Cisco's Unified Videoconferencing products constitute a case in point. Several of the products in the Cisco Unified Videoconferencing 5100, 5200 and 3500 series run on a Linux shell which contains three hard-coded usernames and passwords that cannot be changed.

The accounts can't be deleted, either. Cisco has warned that these products have multiple vulnerabilities that let attackers obtain remote access to them illicitly to compromise them.

It's not as if the danger of embedded credentials and hard-coded passwords is new.

"This is a well-known industry issue and you'd have thought that most major software players would have expurgated these passwords and credentials from their code by now, but it's clearly not the case," Hilwa said.

The problem is most clearly seen in databases, attacks on which often yield thousands of names for cybercriminals to harvest and exploit with identity theft schemes. However, just getting rid of default passwords in databases isn't a solution, because they are included in the databases for a reason.

"Having default accounts is very helpful in a testing environment," Noa Bar Yosef, a senior security strategist at Imperva, told TechNewsWorld. "They let you do everything from testing the connection to creating tables and testing scripts."

For example, every default Oracle installation contains a default test account which is accessed using the credentials "scott" or "tiger," Bar Yosef said. The "scott" default username has a limited set of privileges, but these are sometimes elevated for testing.

The trouble occurs when testers forget to restore the original privilege level for the username or delete the username altogether, and the database is moved into production. That might open the database to hacking, Bar Yosef pointed out.

Vendors generally view hard-coded passwords as unacceptable even though they use them, Barbara Fraser, CTO Consulting Engineering at Cisco, told TechNewsWorld.

"Over the years, I've seen an increased awareness of the risk represented by embedded credentials, but also an increased focus within the industry to eliminate or avoid them altogether," Fraser added.

The trouble is that there's lots of old code that's difficult to secure, IDC's Hilwa pointed out.

Possible Cures

It wouldn't be wise for DBAs to change or delete hard-coded password accounts at once.

For example, the owner of a database may not be able to change a default hard-coded password because it might break the application or he's restricted from doing so, Bar Yosef suggested. He will have to find a bypass solution instead.

That's not necessarily the case, Adam Bosnian, an executive vice president at Cyber-Ark, told TechNewsWorld.

"If you don't change the password correctly and restart the app correctly it would be a problem," Bosnian said. "If you can set the credential there must be a way to reset it and manage it in a more secure manner."

Corporations should set up a database assessment process that tests their databases against accepted industry benchmarks, Bar Yousef recommended. They should also hold one individual accountable for ensuring that default logins and accounts are taken off production servers, she added.

Some security vendors offer products that search for default passwords and notify system administrators in real-time. One is McAfee Vulnerability Manager. Further, third-party applications like John the Ripper and L0phtcrack that audit weak passwords have been available for a while, McAfee's McClure said.

Corporations don't necessarily need a vendor to do the job for them, Bosnian said. "These things can be fixed without product, but you need to monitor what you do," he explained.

Meanwhile, the International Organization for Standardization (ISO) is working on secure coding guidelines, Fraser said.

However, these may not be accepted wholeheartedly by vendors.

"Once completed, it remains to be seen how the secure coding practices will be applied within the industry," Fraser said.

"We will need a few more Stuxnets to give the situation the urgency it deserves," McClure opined.

source: http://www.technewsworld.com/story/Embedded-Passwords-Dangerous-by-Default-71369.html

Optimizing web graphics

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου

Author: Susie Sahim, Web Designer and Google Doodler

Recommended skills: Basic image manipulation

When you optimize every line of code for your website, don't forget about your static content - including images. Simple improvements can drastically decrease your download size, without diminishing the site's quality.

Here are a few tips to help you make your web graphics load faster

Crop out excess white space

Sometimes you have extra space or padding around graphics so that they don't touch accompanying text or web page elements. Instead, crop out that space and use CSS to create the padding around the graphic.

Use the best file format

For images containing flat illustrations or artwork, use the 8-bit PNG or GIF format and reduce the number of colors in the palette. Some image programs such as PhotoShop allow you to save the image for the web and fine-tune the image settings. By reducing the color palette from 256 to something like 32, you greatly reduce the size of the file. The less colors that the image has, the smaller the file size is going to be.

For very detailed and colorful artwork or for photographics, JPG and 24-bit PNG are typically used because they have a much larger color palette. While a 24-bit PNG results in superior image quality, this comes at the price of a larger file size. When you can, use JPG instead and adjust the quality setting so you can compress the image as much as possible within your desired tolerance for image quality.

To compare and contrast, here are the file sizes of the above graphic in various formats:

  • JPG, 60 quality - 32K
  • PNG-8, 256 colors - 37K
  • GIF, 256 colors - 42K
  • PNG-24 - 146K

Also note that JPG has an option called "Progressive" mode. This option adds multiple copies of the image at lower resolution to make the image appear quickly on the screen, while progressively improving in quality. But it also increases the overall size of the image.

PNG also has a similar feature called "Interlaced". You may want to turn this feature off so that the full image downloads quicker.

Because the 8-bit PNG and GIF formats have the potential to result in much smaller image files, try to keep this in mind when creating graphics and illustrations for your site. Try to keep the amount of colors to a minimum and use flat graphics instead of photographs. This way you can create images with palettes of 16 colors, keeping the file size extremely small and fast to download.

source: http://www.google.com/support/webmasters/bin/answer.py?answer=114016

Web metrics: Size and number of resources

Ιστογνώσις ΛΤΔ Σχεδίαση και ανάπτυξη ιστοσελίδων και εφαρμογών διαδικτύου

Author: Sreeram Ramachandran, Software Engineer

Last updated: 26 May 2010

Here are some statistics about the size, number of resources and other such metrics of pages on the world wide web. These are collected from a sample of several billions of pages that are processed as part of Google's crawl and indexing pipeline. In processing these pages, we not only take into account the main HTML of the page, but also discover and process all embedded resources such as images, scripts and stylesheets.

Highlights:

  • The average web page takes up 320 KB on the wire.
  • Only two-thirds of the compressible material on a page is actually compressed.
  • In 80% of pages, 10 or more resources are loaded from a single host.
  • The most popular sites could eliminate more than 8 HTTP requests per page if they combined all scripts on the same host into one and all stylesheets on the same host into one.

Caveats:

  • All resources are fetched using Googlebot, which means they are subject to robots.txt restrictions. For example, some sites (such as the BBC) block CSS and JS.
  • Some sites may present a different view of the resources to Googlebot than to regular users. For example, until recently, Google's own servers used to serve CSS and JS uncompressed to Googlebot, while compressing them for regular user browsers.
  • Pages are rendered and subresources are discovered through the eye of WebKit. If a page serves resources differently for Internet Explorer or Firefox, those won't be visible here.
  • Sampling of pages for processing is not uniformly random or unbiased. For example, pages with higher PageRank are more likely to be included in these metrics.

Averages:

MetricTop SitesAll SitesDescription
Pages 380 million 4.2 billion Number of sample pages analyzed.
Resources 42.14 43.91 Average number of resources per page.
GETs 42.63 44.56 Average number of GETs per page. Similar to number of resources, but also includes redirects.
Hosts 8.39 7.01 Average number of unique hostnames encountered per page.
Resources Per Host 5.02 6.26 Average number of resources per host (derived from the 'Resources' and 'Hosts' values).
Network Size/KB 312.04 320.24 Average size transferred over the network per page, including HTTP headers. If resources were compressed, this would use the compressed size.
Document Size/KB 477.26 376.67 Average uncompressed size of a page and its resources, excluding HTTP headers.
Zippable Size/KB 287.51 170.16 Average uncompressed size of the compressible resources on a page, i.e., those with a Content-Type of 'text/*' or equivalent.
Unzipped Size/KB 32.67 57.07 Average size of the compressible resources that were not sent compressed, i.e., the Content-Type was 'text/*', but Content-Encoding did not include 'gzip' or 'deflate'.
Zipped Ratio 89% 66% Average percentage of compressible bytes that were actually compressed (derived from the 'Zippable' and 'Unzipped' values).
Images 27.58 29.39 Average number of unique images per page.
Image Size/KB 184.73 205.99 Average network size of the images per page.
Scripts 6.75 7.09 Average number of external scripts per page.
Script Size/KB 66.48 57.98 Average network size of the external scripts per page.
Combinable Scripts 4.75 3.75 Average number of requests that could be saved per page if external scripts on the same host were combined.
Stylesheets 4.07 3.22 Average number of external stylesheets per page.
Stylesheet Size/KB 27.17 18.72 Average network size of the external stylesheets per page.
Combinable Stylesheets 3.54 2.02 Average number of requests that could be saved per page if external stylesheets on the same host were combined.
SSL Pages 650 thousand 17 million Number of sample SSL (HTTPS) pages analyzed.
SSL Hosts 6.39 3.23 Average number of unique hostnames encountered per SSL page.
SSL Zippable/KB 263.58 160.47 Average size of the compressible resources per SSL page.
SSL Unzipped/KB 133.74 89.36 Average size of the compressible resources that were not sent compressed, per SSL page.
SSL Zipped Ratio 49% 44% Average percentage of compressible bytes that were actually compressed, per SSL page (derived from the 'SSL Zippable' and 'SSL Unzipped' values).

Percentiles:

MetricTierMeanMin10203040Median60708090Max
GETs Per Page Top Sites 42.63 1 17 21 25 28 33 39 48 60 81 977
All Sites 44.56 1 10 18 24 30 37 45 54 66 86 2,758
Hosts Per Page Top Sites 8.39 1 3 3 4 4 7 8 10 12 17 222
All Sites 7.01 1 1 2 3 4 5 7 8 10 14 374
KB Per Page Top Sites 312.04 0.00 38.15 80.44 119.28 145.51 176.23 208.38 275.48 377.16 597.08 312,426.25
All Sites 320.24 0.00 21.82 54.15 90.76 131.30 177.47 234.67 310.51 428.73 663.19 517,026.13
KB Per Host Top Sites 37.18 0.00 0.73 1.76 3.92 6.73 11.18 17.12 26.75 55.45 132.76 311,872.59
All Sites 45.69 0.00 0.78 1.94 3.60 6.96 13.09 23.97 44.12 85.15 179.08 441,631.71
KB Per GET Top Sites 7.32 0.00 0.46 0.68 1.06 1.60 2.36 3.19 4.76 7.76 16.75 14,852.58
All Sites 7.19 0.00 0.43 0.63 0.92 1.31 1.93 2.90 4.38 7.96 18.46 35,932.92
GETs Per Host Top Sites 5.08 1.00 2.11 2.88 3.50 4.50 5.62 6.75 8.00 9.20 11.25 401.00
All Sites 6.36 1.00 2.33 3.29 4.20 5.14 6.25 7.60 9.33 12.08 18.00 1,045.00
Max GETs Per Host Top Sites - 1 5 9 12 15 18 21 26 33 39 860
All Sites - 1 6 10 15 19 24 29 36 44 59 2,754

source:http://code.google.com/speed/articles/web-metrics.html

JPAGE_CURRENT_OF_TOTAL