Previous Thread
Next Thread
Print Thread
Hop To
#249712 07/15/2012 12:27 PM
Joined: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
I have seen queries to the search engine in the error logs that point to our server being attacked by very long search strings.

INSERT INTO ubbt_SEARCH_RESULTS
(SEARCH_SESSION_ID,SEARCH_WORDS,[...])
VALUES
( '8cfacb698b24bf7b3eff7ec4449a3351' , 'xwkkrgddvl, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\[...]

In which "\" is repeated a million times.

To be honest I think this is a serious weakness - the software shouldn't allow for any large query string (in this case 50MB+) to be sent to SQL.

So I've tried editing the dosearch.inc.php file to insert a maximum length in the search function and throw back an error "You do not have permission to use the search engine." I hope I have fixed this by doing so:

I have found this on line 431:
PHP Code

		// Make sure they are searching for something
		if (!$Words && !$Name) {
			if (!$excluded) {
				$html->not_right($ubbt_lang['NO_WORDS']);
			}
			else {
				$html->not_right($ubbt_lang['SHORT']);
			}
		} 



And added this immediately after it:

PHP Code

		// try and limit the length of the query - KAYJEY
		if (strlen($Words) > 500) {
				$html->not_right($ubbt_lang['NO_SEARCH']);
		}
 

Joined: Dec 2003
Posts: 117
K
Member
Member
K Offline
Joined: Dec 2003
Posts: 117
Please note: changing that code to:

PHP Code

		if (strlen($Words) > 500) {
			$mailmessage = $user['USER_DISPLAY_NAME'] . " - " . strlen($Words);
			mail('yourmailaddress@yourprovider.com', 'Forum search engine abuse', $mailmessage);
				$html->not_right($ubbt_lang['NO_SEARCH']);
		}
 

you will get an e-mail message with the offending user and the length of his search string. Change the 'yourmailaddress@yourprovider.com' to your own address.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
1 members (Nightcrawler), 963 guests, and 210 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)