Posts Tagged ‘Programming’

Odd bugs and the case of an aging database

Sunday, August 29th, 2010

I was doing some troubleshooting recently trying to fix some issues reported in the Captcha of a registration system. The Captcha wasn’t always properly displaying and wouldn’t recognize valid code entries intermittently. After tracing some of the PHP to find just how the Captcha’s were being generated and managed, I found my way to the MySQL database and the table storing the values.

It took only a glance at the last and only row  to determine what the problem was – The primary key for the Captcha table was defined as an INT and had reached the value 65535. With the key unable to increment, any non-valid attempt (be it a bot or someone who couldn’t read the Captcha properly), would cause the system to lock up until the 1 in 100,000 chance that the same value was re-generated and someone correctly matched the code.  The failure resulting from this oversight was essentially a Denial of Service on the registration system.  To temporarily solve the issue, I did a simple reset of the primary key[1], which should buy a few years of development time to resolve the core issue.

This situation possesses an interesting design consideration when building long-running applications, even when you aren’t planning on storing a large amount of data for a long time. Tables that are frequently populated with new data should have measures in place to either handle recycling over-used values or should be built in a way that avoids these sort of conditions.  In the case of the Captcha above, the primary key was hardly used and could have been factored out entirely without the application running differently.

Looks like it’s time to get this database a subscription to AARP and some Depends….

References:

[1] Resetting a Primary Key

The psych0tik network presents: proxyElite

Friday, July 2nd, 2010

After nearly 3 years of downtime, psych0tik is happy to bring you the new and improved proxyElite!

We’ve spent the last few months completely rewriting the core code and redesigning the database to be more stable and reliable. Thusfar, we’ve been very happy with the results. The proxyElite web application itself is definitely in an infantile state as far as development and design, but we wanted to bring you usable proxy results sooner rather than later.

Features of the new proxyElite include:

  • Dynamically updated proxy databases – new proxies are loaded automatically
  • Multiple methods for verifying proxy’s usability – to improve accuracy
  • A proxy detector tool – to help determine how noticeable the proxy you are using is
  • Extensible design – more modules for growing and updating proxy lists are easily added (and some are already in development)

While we’ve done a fair amount of testing on our development server to make sure this code is production-ready, it is still beta code. If you see something that looks broken, wrong, or otherwise out of place – please let us know!

You can check out the new site, at the old address: http://proxyElite.net

~psych0tik staff

crackIt: aircrack-ng automated

Saturday, November 15th, 2008

I was playing around with my wireless network early today and realized I didn’t have the key written down near by where I was working. Rather than expending the effort of getting up and moving, I decided I’d just crack it.

After starting up airodump-ng I was looking at aircrack-ng’s man page. Trying to decide which options would make it crack most effectively. After browsing the man page for half an hour or so I decided that they should be run in a certain order for best effect. Still being lazy, I began to script this up. I added some ‘fluff’ and called it crackIt.

crackIt uses 20 different permutations of aircrack-ng. These different configurations are run from fastest targetted, least reliable to slow, broad, sure-fire methods. I chose to order it this way because in my experience, the targeted, least reliable method is effective in a large number of cases.

crackIt begins using aircrack’s standard configuration with the fudge factor lowered to 1. The fudge factor is used to determine how many votes should required for a key to be ‘valid’. The largest number of votes for each key, the key in the left most position’s parenthesis value, is divided by the fudge factor. The result is the minimum number of votes required to be ‘valid.’ By reducing this to one, we provide a very targeted, quick method of attack. This method is prone to false positives or failing.

Next, crackIt uses the standard configuration of aircrack, raising the fudge factor back to the default 2. It then moves onward to try again with each of the 17 Korek attacks omitted. The Korek attacks are prone to large numbers of false positives. In the event both the fast-crack and default modes in aircrack fail, odds are good that one of these is to blame.

Finally, crackIt uses “an experimental single brute-force attack which should only be used when the standard attack mode fails with more than one million IVs.” aircrack won’t even let you run this method without 780,000 IVs. If you’ve left airodump-ng running, by the time it gets to this mode, we should have atleast that.

Technical details, usage, and future plans can be found in the fully commented code here.

References:

aircrack-ng man page

http://www.aircrack-ng.org/doku.php?id=aircrack-ng

Reading Rainbow: Episode 12

Sunday, August 24th, 2008

While working on my web-spider class for an application I was developing, I did some searching for efficiency of spidering algorithms. I came across this comparison of the depth-first versus breadth-first search algorithms. http://www.leekillough.com/trapopt.html

Using a combination of Javascript and CSS, it is possible to enumerate parts of a user’s history. This site demonstrates this with a “finding your gender” based on which sites you have viewed. http://www.mikeonads.com/2008/…-history-estimate-gender/

The following two links provide a breakdown of file systems based on capabilities (the wikipedia post) and performance (the linuxgazette post.) I’ve been using these lately while re-installing a few machines and have found them to be more than helpful.

http://linuxgazette.net/122/piszcz.html

http://en.wikipedia.org/wiki/Comparison_of_file_systems

Typo-squatting is a well known method of gathering data or presenting spam-sites. This article from TechRepublic gives a few methods for protecting against such a threat. http://blogs.techrepublic.com.com/security/?p=543&tag=nl.e036

This is a handy little web application that will generate your .htaccess file to restrict access based on what country the IP address is from. http://blockacountry.com/htaccess.php

If you are a programmer anything I like I am, you are constantly trying to find ways to better yourself or keep skills sharp. A friend of mine showed me this set of exercises designed to help keep things fresh. http://codekata.pragprog.com/2007/01/code_kata_backg.html

Reading Rainbow: Episode 7

Sunday, May 25th, 2008

In the wake of so many ISP’s getting away with murder and the government looking the other direction it’s good to see that Florida is stepping in and fining Version for poor response time. http://news.cnet.com/Florida-…00-1036_3-6239655.html?tag=html.alert.hed

This is a great video for both optimizing and securing your Windows XP system. It shows exactly how to disable five services you probably don’t need to be running. http://blogs.techrepublic.com.com/itdojo/?p=120&tag=nl.e101

If you have ever had the “Warning: Using insecure memory” message display when using a tool such as GnuPG this article is for you. Not only does it explain exactly what that means it also goes into how to prevent the problem. http://blogs.techrepublic.com.com/security/?p=457&tag=nl.e036

Panda security has now launched thier Security as a Service for businesses. Among other services they will be offering: outsourcing of infrastructure, automated updates and patching, compliance checks, risk management, and remote management tools. http://sev.prnewswire.com/computer-software/20080519/LAM04119052008-1.html

I read this post on a friend of mine’s blog and thought it was rather useful. I’ve had PHP scripts running on cron before that had exactly this problem. They would lock up after a while and before I knew it, I had about 15 “undead” PHP processes just eating up my CPU. What was worse was that my shared host only allowed each user 15 processes at the same time, so slowly but surely the rest of my sites would go down. http://www.toosweettobesour.com/2008/05/21/amp-and-runaway-scripts/

Reading Rainbow: Episode 6

Monday, May 19th, 2008

I played with both of these plugins. The view formated source one didn’t do a whole lot for me, but the view source chart was a great improvement. It makes checking out HTML much easier, and with the added ability to collapse various blocks of code it makes it easier to sort through just what I want. http://blogs.techrepublic.com.com/programming-and-development/?p=670&tag=nl.e055

A friend asked me a few months ago to help him uninstall Internet Explorer 7 and it was more than a pain. Here is a great explanation of how to do it painlessly.http://blogs.techrepublic.com.com/window-on-windows/?p=680&tag=nl.e101

As security becomes more mainstream, solutions grow beyond the capabilities of do-it-yourself solutions. Here is discussed various ways to keep current and secure, without sacrificing stability and redundancy. http://blogs.techrepublic.com.com/security/?p=456&tag=nl.e036

As hacking becomes “more popular,” or perhaps simply easier with the availability of tools, proper attacks are not the elegant assaults of yesteryear. Now, brute force attacks are run simply because the tool is easily downloadable and anyone with an internet connection and a target can attempt to crack user accounts. Discusses her further is an example of just this situation. http://www.informationweek.com/news/security/attacks/showArticle.jhtml?articleID=207603339&subSection=Cybercrime

I saw this site on a forum and it’s really wonderful. Has texts on all sorts of programming languages, networking, the works. http://stommel.tamu.edu/~baum/programming.html

Vanishing Point: HTTP Optimizer

Wednesday, May 14th, 2008

For work I built an HTTP Optimizer: Vanishing Point. It’s a framework that accepts plugins, so that custom optimization engines can be built for different file types. Currently I have released a CSS and Javascript optimizer plugin. Both implement packers/miniifiers designed by other people, however; I added in my own code to further optimize them. They also will combine files so as to save time by reducing HTTP requests. In our benchmarks they have shown that they do infact reduce page load time.

Here is the google code SVN repo:

http://vanishingpoint.googlecode.com/svn/trunk/

pwlib.java

Tuesday, May 13th, 2008

I have finished up the first version of pwlib.java. It was created in Java 1.4, because I haven’t bothered to update Java in ages. I should be revising it for 1.6 soon enough, but this is something to get you going. I haven’t done a whole lot of testing on it just yet, so feel free to post any bugs you may find.

Currently it only supports hashing for md5 and SHA1, but that will change later on. Right now I’m just trying to get the code base out in all four languages. Next up will be python. Enjoy.

pwlib.java (Java 1.4)

Reading Rainbow: Episode 4

Monday, May 5th, 2008

A friend of mine showed me the following site after a discussion over what language was best for a problem. They have “benchmark problems” to test efficiency, memory size, etc. http://shootout.alioth.debian.org/gp4/

For those of you following the Hans Reiser case, he was convicted of killing his wife. This article goes into some detail over the case. The case was circumstantial at best. http://blog.wired.com/27bstroke6/2008/04/reiser-guilty-o.html

Chad Perrin explains a few different ways to close of unwanted ports on your linux system. Explaining both inetd and xinetd and how to manage them as well as ways to track down things that aren’t managed by either or for systems that run neither. http://blogs.techrepublic.com.com/security/?p=447&tag=nl.e036

Slackware 12.1 has been released. Now using the 2.6.24.5 kernel (SMP and non-SMP) and with added features. http://www.slackware.org/announce/12.1.php

pwlib.php

Saturday, May 3rd, 2008

This is my first build of the php version of pwlib. Nothing is quit set in stone yet and for all I know I might scrap the whole thing. This should be enough to see how it will interface. If you have and suggestions or would like to see a feature put in, post a comment and I’ll look into it.

PHP 4 Version: http://www.samurainet.org/pwlib/php/pwlib-php4.src

PHP 5 Version:http://www.samurainet.org/pwlib/php/pwlib-php5.src

Wordlist (its just for testing): http://www.samurainet.org/pwlib/php/test.txt

I still need to finish optimizing the code as well as making some of the features more robust. Enjoy the code.