Sunday, 2 November 2014
Saturday, 1 November 2014
Top 7 PHP Security Vulnerabilities
Security is not a list of things you do. Security is a way of thinking, a way of looking at things, a way of dealing with the world that says “I don’t know how they’ll do it, but I know they’re going to try to screw me” and then, rather than dissolving into an existential funk, being proactive to prevent the problem. PHP has some major vulnerabilities which can be xploited and even prevented too. So lets start ..
SQL Injection
Number one on the hit list is the SQL injection attack. In this case, someone enters an SQL fragment (the classic example is a drop database statement, although there are many possibilities that don’t include deletions which could be just as destructive) as a value in your URL or web form. Never mind now how he knows what your table names are; that’s another problem entirely. You are dealing with an insidious and resourceful foe.
So, what can you do to avoid this? First and foremost you need to be suspicious of any input you accept from a user. Believe everyone is nice? Just look at your spouse’s family… they’re weird and freaky, some dangerously so.
The way to prevent this sort of thing is to use PDO Prepared Statements. I don’t want to go through a full discussion of PDO now. Suffice to say prepared statements separate the data from the instructions. In doing so, it prevents data from being treated as anything other than data.
Must Read: So more details, read this Preventing Sql injection through prepared statements
XSS (Cross Site Scripting)
Curse the black hearts who thrive on this type of deception. Parents, talk to you children today lest they become evil XSS’ers!
The essence of any XSS attack is the injection of code (usually JavaScript code but it can be any client-side code) into the output of your PHP script. This attack is possible when you display input that was sent to you, such as you would do with a forum posting for example. The attacker may post JavaScript code in his message that does unspeakable things to your site. Please don’t make me go into detail; my heart weeps at what these brigands are capable of.
For more information and how to protect yourself, I suggest reading these fine articles on PHPMaster:
- Cross Scripting Attacks by George Fekette
- Input Validation Using Filter Functions by Toby Osbourn
Source Code Revelation
This one has to do with people being able to see the names and content of files they shouldn’t in the event of a breakdown in Apache’s configuration. Yeah, I dig it, this is unlikely to happen, but it could and it’s fairly easy to protect yourselves, so why not?
We all know that PHP is server side – you can’t just do a view source to see a script’s code. But if something happens to Apache and all of a sudden your scripts are served as plain text, people see source code they were never meant to see. Some of that code might list accessible configuration files or have sensitive information like database credentials.
The solution centers around how you set up the directory structure for your application. That is, it isn’t so much a problem that bad people can see some code, it’s what code they can see if sensitive files are kept in a public directory. Keep important files out of the publicly-accessible directory to avoid the consequences of this blunder.
Remote File Inclusion
Hang on while I try to explain this: remote file inclusion is when remote files get included in your application. Pretty deep, eh? But why is this a problem? Because the remote file is untrusted. It could have been maliciously modified to contain code you don’t want running in your application.
Suppose you have a situation where your site at www.myplace.com includes the library www.goodpeople.com/script.php. One night, www.goodpeople.com is compromised and the contents of the file is replaced with evil code that will trash your application. Then someone visits your site, you pull in the updated code, and Bam! So how do you stop it?
Fortunately, fixing this is relatively simple. All you have to do is go to your
php.ini and check the settings on these flags.allow_url_fopen– indicates whether external files can be included. The default is to set this to ‘on’ but you want to turn this off.allow_url_include– indicates whether theinclude(),require(),include_once(), and require_once() functions can reference remote files. The default sets this off, and settingallow_url_fopenoff forces this off too.
Session Hijacking
Session hijacking is when a ne’er-do-well steals and use someone else’s session ID, which is something like a key to a safe deposit box. When a session is set up between a client and a web server, PHP will store the session ID in a cookie on the client side probably called PHPSESSID. Sending the ID with the page request gives you access to the session info persisted on the server (which populates the super global
$_SESSION array).
If someone steals a session key, is that bad? And the answer is: if you aren’t doing anything important in that session then the answer is no. But if you are using that session to authenticate a user, then it would allow some vile person to sign on and get into things. This is particularly bad if the user is important and has a lot of authority.
So how do people steal these session IDs and what can decent, God-fearing folk like us do about it?
Session IDs are commonly stolen via a XSS attack, so preventing those is a good thing that yields double benefits. It’s also important to change the session ID as often as is practical. This reduces your theft window. From within PHP you can run the
session_regenerate_id() function to change the session ID and notify the client.
For those using PHP5.2 and above (you are, aren’t you?), there is a
php.ini setting that will prevent JavaScript from being given access to the session id (session.cookie.httponly). Or, you can use the functionsession_set_cookie_parms().
Session IDs can also be vulnerable server-side if you’re using shared hosting services which store session information in globally accessible directories, like
/tmp. You can block the problem simply by storing your session ID in a spot that only your scripts can access, either on disk or in a database.Cross Site Request Forgery
Cross Site Request Forgery (CSRF), also known as the Brett Maverick, or Shawn Spencer, Gambit, involves tricking a rather unwitting user into issuing a request that is, shall we say, not in his best interest. But rather than me going on and on about CSRF attacks, refer to an outstanding example of just what kind of content we have here on PHPMaster: Preventing Cross-Site Request Forgeries by Martin Psinas.
Directory Traversal
This attack, like so many of the others, looks for for a site where the security is not all that it should be, and when if finds one, it causes files to be accessed that the owner did not plan to make publicly accessible. It’s also known as the ../ (dot, dot, slash) attack, the climbing attack, and the backtracking attack.
There are a few ways to protect against this attack. The first is to wish really, really hard that it won’t happen to you. Sometimes wishing on fairies and unicorns will help. Sometimes it doesn’t. The second is to define what pages can be returned for a given request using whitelisting. Another option is to convert file paths to absolute paths and make sure they’re referencing files in allowed directories.
These are Top 7 Vulnerabilities in PHP. Please do like and share this post and do join our facebook page AnonHackSociety
Saturday, 11 October 2014
How to Store Database records in an Multidimentional Array in PHP
About Array in PHP
Like any other programming languages or web languages, array plays an important role in storing many data.
Storing single array elements in PHP in as any normal languages.
Syntax : array () ;
But to store many array within an array, there are Multidimensional Arrays. PHP have the Array of Array concept.
Syntax: array (array());
Array in Arrays in PHP to store database values.
Well this post seems to be simple. Yes , i had an issue with storing the values in multidimensional arrays, but there haven't been any proper post till yet, of actual way of storing and dynamic looping used for storing data.
So lets start,
I want to store watches database values. For each watch there are 5 parameters (coloumns).
First I will extract the data from database using select query
$res = mysql_query("select * from watches ") or die(mysql_error());
Next, we should initialize array of array for storing data
$wat = array(array());
Now, below is the simple snippet to dynamically store values in that $wat array.
$i=0;
while($row = mysql_fetch_array($res))
{
$j=0;
$wat[$i][$j++] = $row['brand'];
$wat[$i][$j++] = $row['modelname'];
$wat[$i][$j++] = $row['price'];
$wat[$i][$j++] = $row['gender'];
$wat[$i][$j++] = $row['movement'];
$i++;
}
Now if we want to display all the contents of data in that array, we can do something like this.
for($i=0 ; $i<$rows ; $i++)
{
for($j=0 ; $j< $columns; $j++)
{
echo $wat[$i][$j]."<br>";
}
}
So we had store and displayed the data from the database successfully.
If you liked the post, do share and like us at AnonHackSociety
Thursday, 4 September 2014
AutoHotkey, create your own shortcuts
Creating your own shortcuts with AHK
Hackers don't like to waste their time and brains.
Hackers don't do the same task again and again.
If there's a task you always need to do, creating a shortcut key helps.
It's so easier to press CTRL+C than Right Click -> Copy.
Even if you are not a hacker, you visit Facebook each day.
Everytime you want to visit, you turn on your browser, click on the address bar, type facebook.com and press enter.
SO LONG!
I only press Windows Key + F and there comes Facebook.
If you read below, you will also be able to create such shortcuts for yourself.
AutoHotkey
AutoHotkey allows you to create your own macros and hotkeys.
You can create your tasks, you can do multiple operations on one click or keystroke.
We will learn how to write very basic AutoHotkey scripts here.
To download AutoHotkey head to AutoHotkey.com
Download and install AutoHotkey.
Now you can run AutoHotkey scripts on your computer.
An AutoHotkey script file has a .ahk extension. To run the script you just have to run the file and an icon will appear in your quick launch bar.
Just create your scripts and save as script.ahk and run it.
Creating AutoHotkey Script
Opening a website:
To open a website in your default web browser:
#n::Run www.google.com
The Run command is used to launch a program. The "#" stands for the windows key. The above line of code means that
www.google.com will be opened when Windows Key + n is pressed.
#::Run www.google.com
Run notepad
return
The above code executes two things on the pressing of Windows key + n. It runs notepad and also opens www.google.com
Similarly ^ stands for CTRL and ! stands for ALT.
Also you can write scripts to automate keystrokes.
For example, if your script contains:
::btw::by the way
This will automatically convert your "btw" to "by the way". AutoHotkey is a time saver. You can do tons of things with it.
You can automate form filling. You can do all our everyday tasks on one click.
If you use AutoHotkey everytime, you can add those scripts to your Startup folder.
You must read the AutoHotkey Official Documentation and Tutorials. You can learn AutoHotkey scripting there and write scripts according to your need.
Tuesday, 2 September 2014
Secure Socket Layer Torn Apart [Complete]
SECURE SOCKETS LAYER LEARNING [COMPLETE]
Using only a simple packet sniffer, an attacker can easily intercept data being sent accross the Internet, or even a LAN. As a result, data sent in plain text will surely not remain safe.
Therein lies the need for encryption standards, which allow passage of data from one system to another.
SSL INTRODUCTION
Secure Socket Layer was developed by Netscape, with its main aim to create a secure protocol to ensure that a client and host could communicate or transfer data and information securely.
SSL is what makes secure e-commerce and e-banking possible.
It is important to note that SSL has been succeeded by Transport Layer Security(TLS)
which is quite similar in its working and concepts to its predecessor.
SSL FUNCTIONS
SSL encrypts data at the sender's end and decrypts data at the reciever's end.
Such encryption and decryption of data also ensure that an attacker cannot intercept the data in transit, tamper with it , or even execute Man-In-the-Middle impersonation attacks.
Any tampering done with SSL encrypted data is usually easily detected through built-in checksum tests.
SSL provides for two-way authentication -that is both client's and server's identity are verified.
Another reason behind the widespread use of SSL protocol is that it is application protocol independent and can be used with absolutely any high level protocol.
SSL FEATURES
SSL-encrypted connection : This provides for the secure transaction of encrypted data between the client and the host. This feature of SSL performs the encryption and decryption of the data packets being sent between the client and server.
SSL client authentication : This optional feature allows for verification of the client's identity and prevents identity hijacks, or spoofing attacks. Hence this feature makes it difficult for a malicious attacker to fool the destination system into believing that the attacker system is the client.
SSL server authentication : This allows for verification of server's Certificate Authority (CA), which is the certificate given to the server by companies such as Verisign, Cybertrust,Thwate and others. This SSL feature is a very good countermeasure against phishing attacks.
SSL PROTOCOL COMPONENT
The main SSL protocol is made up of the following two sub-protocols:
SSL Record Protocol : This protocol looks after the transmission of the encrypted data and the format in which it is being transmitted. In addition, it ensures data integrity in the transfer process and also ensures that no data is lost in the transit from the source to destination.
SSL Handshake Protocol: This protocol helps to determine the session key, which is the secret symmetrical key used to encrypt data after a SSL connection has been established between client and the host. Without this protocol, secure communication would not be possible.
DETERMINING WHETHER YOUR CONNECTION IS SECURE
There are several ways to determine whether your connection is safe :
Check your browser's status bar : This is the easiest ways to determine whether your connection is secure. If you see a closed padlock , then the connection is secure, else if the padlock is open or is not visible, the connection with remote server is not secure.
Check your browser's URL box: If the connection is secure , you will see https:// , else you will as http:// in the URL box.
Check for Certificate Authority : To determine whether the page you have visited has a CA, click on URL box as shown in image. Look for the Connection field. This field should normally display the Web site's Certificate Authority. It is important to note that sometimes malicious Web designers can forge a certificate or display a fake one.
A typical SSL transaction involves various encryption algorithms such as RSA, DSS, DES,RC4. It is within these encryption algorithms where the vulnerability of SSL lies.Over the years, it has been proven that SSL is not secure as it seems to be. The problem lies int the fact that the encryption algorithm used along with SSL are not foolproof and can easily be cracked using bruteforce techniques running on a powerful computer. Using this technique , all SSL versions below 3.0 (SSL 1.0 , SSL 2.0) have already been cracked.
However SSL 3.0 with 128 bits, will take a very long time.
168-bit encryption is also available. Note, however that higher encryption levels are not allowed for use outside the US due to national security reasons
That' all much about SSL ,still its a vast topic overall....Hope you understood pretty well about SSL stuff.
If you have any doubts, feel free to comment below
Monday, 1 September 2014
Security Onion
SECURITY ONION
What is Security Onion :
-Security Onion is a Linux distro for IDS (Intrusion Detection and NSM (Network Security Monitoring).
- Developed by Doug Burks.
-Designed to make deploying complex open source tools via a single package.
(Snort, Suricata, Sguil, Snorby, etc.)
- Allows the choice of IDS engine, analyst console, web interfaces.
- Free (Open Source) !!
What in the Onion
Over 60 custom tools
Snort – Signature based IDS
Sguil – Security analyst console
Squert - View HIDS/NIDS alerts and HTTP logs
Snorby - View and annotate IDS alerts
ELSA - Search logs (IDS, Bro and syslog)
Bro - Powerful network analysis framework with highly detailed logs
OSSEC - Monitors local logs, file integrity & rootkits
"Network security monitoring is the collection, analysis, and escalation of indications and warnings to detect and respond to intrusions.“
Installation of Security Onion :
Installation of onion is simple , but takes time to install a pretty bunch of tools within it.
You can find the installation procedure in the below link.
This is the final GUI after an successful installation
Why Security Onion
- A complete set of Network Monitoring linux distro provides a better lookout for the network analysts.
- Since its free, its feasible for the small organization for their network analysis.
- Easy to install and use.
Finally,
Where do we go now
Download/Install
You can find videos for more on Security Onion
Sunday, 31 August 2014
RealVNC, Fast Remote Desktop for LAN
RealVNC, why and how?
The use of computers has greatly increased. It is now necessary for business corporations to keep their networks secure and also easily accessible.
Ease of access is the need of people. We now want everything easily accessible, anywhere and at any time.
We want the photos we captured on our phone right away on our PC. We want to control our computer through our phone. We want to remote control our phone from the PC.
Remote desktop connections have become very important. It is not feasible for computer technicians to roam about and fix problems of people who are techies. Remote desktop connections help solve software related problems without physically visiting to repair.
When it comes to remote desktop, we have many options like Teamviewer, Ammy Admin etc. These are pretty good software programs with nice features. But when these are used on LAN, they lack speed.
These don't work without the internet and even if you are online these programs are pretty slow even if you want to connect on LAN. They turn you to an inefficient computer engineer.
VNC helps you when you are on LAN.
VNC stands for Virtual Network Computing. It is a desktop sharing system that uses Remote Frame Buffer rotocol (RFB) to remotely control another computer.
VNC and RFB are registered trademarks of RealVNC Ltd.
RealVNC is a set of programs that allow you to create and connect VNC servers. It comes in three versions - Free, Personal and Enterprise. The free version does not include file transfer.
To get RealVNC, you must head to RealVNC Downloads. You will se a range of items to download. Download the full package which contains VNC server as well as viewer, for your operating system.
Download it and install the package. Also register on RealVNC.com and get your license key (compulsory for free users also).
After installation, configuration is easy.
Creating a VNC Server
Go to START -> RealVNC -> VNC Server.
You will be presented with something like this:
You can configure your VNC server using the 'More...' button. You can set a password so that there are no unnecessary users.
VNC Viewer users can connect using the given IP address.
Connecting to a VNC Server
Go to START -> RealVNC -> VNC Viewer
You will be presented with something like this:
Connecting is as easy as typing the server's IP addresses and clicking 'Connect'.
That's it enjoy remote desktop connections on LAN.
VNC is as fast as using the host computer itself.
Why to use VNC?
- Faster than other software
- Fast Remote Desktop Connection
- Allows configuring multiple machines from one machine
That's all about VNC. For any queries you can personally contact and ask.
Subscribe to:
Posts (Atom)
The world have changed a lot, people have changed a lot
To be continued ...
-
Admin Page Vulnerability | Hacking Credit Card Here is the second part of Hacking Credit Card . Another easy & worki...
-
Python Tutorials Part 1 Python is a programming language that is freely available and that makes solving a...
-
VP-ASP Shopping Cart 5.00 Exploit Here is a small exploit to Hack & Steal Credit card info & many other d...






