News Feed
Sections

News Archive
feed this:

Brian Moon's Blog:
in_array is quite slow
June 06, 2008 @ 09:36:47

Brian Moon had a problem - one of his cron jobs was lasting for much longer (hours!) than it should have been. He tweaked, tested and debugged the script and finally came down to a call to in_array, something he comments on as being "quite slow".

See, this job is importing data from a huge XML file into MySQL. After it is done, we want to compare the data we just added/updated to the data in the table so we can deactivate any data we did not update. [...] We then compared the two arrays by looping one array and using in_array() to check if the value was in the second array. [...] So, that was running for hours with about 400k items. Our data did not contain the value as the key, but it could as the value was unique.

He method, replacing the in_array call that had to do a full array scan for each time through the loop with an isset/unset combo on the unique key, changed the execution time down from about 4 hours to 0.8 seconds.

1 comment voice your opinion now!
inarray compare array unset isset unique key execution time



Nessa's Blog:
Common PHP Errors
December 10, 2007 @ 12:05:00

Nessa has set up a post in an effort to help budding PHP developers out there with some of the most common problems they might come across in their work and how to handle them a bit more gracefully with error handling:

I'm going back to the basics here, you know, when you wrote your first PHP script and saw an ugly-ass error message pop up on your screen? Error messages are the best tool a programmer has.

She talks about how to set up the error reporting first, making sure that you're getting things up and useful. From there she describes some of the common errors that you might see including:

  • Parse errors
  • MySQL Result source errors
  • Stream errors
  • Max Execution Time errors

Check out the rest of the post for more types.

0 comments voice your opinion now!
error handling parse mysql resource stream execution time error handling parse mysql resource stream execution time


PHP Discovery Blog:
Dangers of Remote Execution
November 21, 2007 @ 13:48:00

On the PHP Discovery blog, there's a new post reminding PHP developers of some of the more dangerous ways that remote execution could effect your site and some of the common entry points it can have.

PHP has numerous ways to execute raw PHP code unless you the programmer stops it. Best way in preventing these methods is making sure you check the input of what your users are inputting, and making sure you escape all malicious actions that a hacker,cracker, kiddy scripter might want to do to your website.

He summarizes four of the things from the Pro PHP Security book from Apress (by Chris Snyder and Michael Southwell) that can leave holes in you application for would-be explots - preg_replace, shell_exec/exec, eval (which we all know is only one letter from "evil" anyway) and require/include.

0 comments voice your opinion now!
danger remote execution pregreplace include eval shellexec exec require danger remote execution pregreplace include eval shellexec exec require


Secunia.com:
PHP "glob()" Code Execution Vulnerability
July 16, 2007 @ 13:52:38

As reported here on Secunia (as discovered by shinnai), there's a code execution vulnerability in PHP's glob function:

The vulnerability is caused due to an error in the handling of an uninitialized structure inside the "glob()" function. This can be exploited to execute arbitrary code, which may lead to security restrictions (e.g. the "disable_functions" directive) being bypassed.

The vulnerability is confirmed in the 5.2.3 win32 installer. Other versions may also be affected.

The issue is marked as "less critical" and can be avoided easily by only allowing trusted users the correct permissions to execute PHP code on the server.

0 comments voice your opinion now!
glob vulnerability execution code bypass security glob vulnerability execution code bypass security


Secunia.com:
TCExam PHP Code Execution and Cross-Site Scripting
May 01, 2007 @ 14:18:00

TCExam users will definitely want to pay attention to this latest advisory posted by Secunia detailing a PHP code execution and cross-site scripting issue that's been found:

rgod has discovered two vulnerabilities in TCExam, which can be exploited by malicious people to conduct cross-site scripting attacks or to compromise a vulnerable system.

The two issues is related to two different inpus not being handled properly - the mishandling of the SessionUserLang cookie and the _SERVER[SCRIPT_NAME] value. Neither of these are being sanitized.

This issue effects users of the TCExam 4.x series but a new version, 4.1.000, has already been released and made available for download.

0 comments voice your opinion now!
tcexam crosssitescripting xss execution sanitize tcexam crosssitescripting xss execution sanitize


Christian Stocker's Blog:
Upload Progress Meter finally in PECL
December 05, 2006 @ 07:09:44

According to this note from Christian Stocker on the BitFlux blog, the upload progress meter (using the new file upload hooks introduced in recent PHP versions) has finally been included, officially, into PECL.

After some tweaking, code improvements and remote code execution vulnerability fixes, I finally put the uploadprogress extension into PECL.

Windows users might be out of luck for a while though, since Christian's not pursuing binaries for the package. However, the source is there, and anyone is more than welcome to try...

1 comment voice your opinion now!
pecl upload progress meter package official remote code execution windows pecl upload progress meter package official remote code execution windows


Hardened-PHP.net:
Zend Platform Multiple Remote Vulnerabilities
August 24, 2006 @ 07:58:24

According to this new advisory on the Hardened-PHP project's site, there are some issues with the Zend Platform product that could cause a number of security issues becaue of malformed session IDs.

During the development of suhosin, which is our new PHP protection module, several compatibility tests with binary 3rd party PHP extensions like the Zend Platform and the Zend Optimizer have been made. When testing the session protection features of suhosin, we discovered that the session clustering system, which is shipping with the Zend Platform is vulnerable to several different attacks.

They mentions a few things a potential attacker could use this issue for, including crashing the session daemon, remote code execution, and being able to view and write files of their choice (like session files) to execute malicious code.

The details are listed out, but a "proof of concept" isn't published for this exploit. Thankfully, Zend has already provided a patch for the issue which can be downloaded at Zend's website (an upgrade to version 2.2.1a).

0 comments voice your opinion now!
vulnerabilities zend platform remote session execution crash vulnerabilities zend platform remote session execution crash


International PHP Magazine:
IPM Poll Question Which One is Most Dangerous?
August 17, 2006 @ 14:12:41

The International PHP Magazine has posted the results from their latest poll, this time asking which one of their options is the most dangerous kind of problem an application can have.

Options included "remote code execution", "SQL injections", and "file system attacks". Topping the charts, and almost typing for first place are "remote code execution" and "SQL injection", with SQL edging out the remote code.

The majority believes that 'SQL Injection' is the most common PHP attack as it garnered 33.6% of the votes. The PHP attack 'Remote Code Execution' scored 30.9% of the votes. The options 'File system attacks' and 'Cross-site Scripting' bagged 10.9% and 8.2% respectively. Not many people seem to consider the existence of any other PHP attack as the option 'Others' polled a dismal 0.9%.

Their latest poll goes with a different subject, asking readers to vote on which of their options is the best way to speed up a site. Check it out and cast your vote today!

0 comments voice your opinion now!
poll question most dangerous attack type sql injection remote code execution poll question most dangerous attack type sql injection remote code execution


Net-Security.org:
SUSE Security Announcement - php4,php5 problems
June 16, 2006 @ 06:14:29

In a new SUSE security announcement today, issues have been found with PHP4 and PHP5 bundled with serveral versions of their Linux operating system.

The four issues found are as follows:

  • Invalid characters in session names were not blocked.
  • CVE-2006-2657: A bug in zend_hash_del() allowed attackers to prevent unsetting of some variables.
  • CVE-2006-1991, CVE-2006-1990: Bugs in the substr_compare() and wordwrap function could crash the php interpreter.
  • CVE-2006-2906: A CPU consumption denial of service attack in php-gd was fixed.

These issues affect the foloowing versions of SUSE: 10.1, 10.0, 9.3, 9.2, 9.1, Enterprise Server 8, SLES 9, and UnitedLinux 1.0. They can all be used to execute any arbitrary code the user chooses to inject. The severity level is higher on this one, but not at a critical level. It's still recommended, however, that you upgrade as soon as possible. Links to the various upgrade packages can be found here

0 comments voice your opinion now!
suse security issue remote code execution php4 php5 suse security issue remote code execution php4 php5


PHPMac.com:
IP Banning
March 06, 2006 @ 07:18:29

PHPMac.com has posted a quick tutorial on how to "ban an IP" from your site.

Blocking certain IP addresses from your site is actually much easier than you might think.

In fact, it is only a seven-line code inserted at the top of your page!

The code basically just looks in an array of IP values and checks to see if the remote user's matches any of them. If it does, it echos out an error and stops the page execution. Obviously, this is just a basic example, and could be enhanced with a databse table that would be easier to manage than just the static array.

0 comments voice your opinion now!
php IP banning remote address check array stop execution php IP banning remote address check array stop execution



Community Events











Don't see your event here?
Let us know!


mysql release example cakephp PEAR application framework developer book conference PHP5 job code database zendframework ajax zend package releases security

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework