Connect with us

Tips & Tricks

WordPress Security Hacks

Published

on

Hi guys this is my first post on wpcult the great site Austin built.  Hope you guys find it usefull.

If you run a blog using the wordpress software then your blog is a target to hackers.  Below I will list some hacks and just how they can help you keep your business/site safe.

The following is  code to Block Bad Queries and protect your blog from malicious URL Requests.

Place the following code into a text file and name it what ever you like for example blockbadqueries.php upload it to your plugin folder and activate it in your wordpress admin just as you would any other Plugin

<?php
/*
Plugin Name: Block Bad Queries
Plugin URI:
http://perishablepress.com/press/2009/12/22/protect-wordpress-against-malicious-url-requests/
Description: Protect WordPress Against Malicious URL Requests
Author URI:
http://perishablepress.com/
Author: Perishable Press
Version: 1.0
*/
global $user_ID; if($user_ID) {
  if(!current_user_can(‘level_10’)) {
    if (strlen($_SERVER[‘REQUEST_URI’]) > 255 ||
      strpos($_SERVER[‘REQUEST_URI’], “eval(“) ||
      strpos($_SERVER[‘REQUEST_URI’], “CONCAT”) ||
      strpos($_SERVER[‘REQUEST_URI’], “UNION+SELECT”) ||
      strpos($_SERVER[‘REQUEST_URI’], “base64”)) {
        @header(“HTTP/1.1 414 Request-URI Too Long”);
 @header(“Status: 414 Request-URI Too Long”);
 @header(“Connection: Close”);
 @exit;
    }
  }
}
?>

 This Great plugin was made by Jeff Starr of Digging into WordPress

 

 

Protecting your blog with .htaccess 

.htaccess files have lots of possibilities. below is some code that will help protect your wordpress from modification of _REQUEST and/or GLOBALS and scripts injection.

 This is real simple just paste the following code into your .htaccess file. Always make a backup of your .htaccess before editing, better to be safe.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]

 

Thanks to Oussama for this great hack

Continue Reading
243 Comments

243 Comments

  1. Tina @ Female Hair Transplant

    September 2, 2010 at 3:02 am

    For a first time post the article is lucid and very useful.

  2. Oliver Mack

    September 5, 2010 at 4:49 pm

    Thanks for sharing this tip with us, it is very helpful, running online businesses we have to consider taking precautions procedures in order to work safer.

  3. landscape prints

    September 12, 2010 at 4:51 am

    It’s not a very secure place, the internet, is it?! I can’t believe how much trouble I have to go to as a blogger to ensure everything is a) working and b) secure!

    Ah well!

  4. Henri Labelle

    September 13, 2010 at 8:05 am

    Thanks for the information! I’ll secure my blog right now!

    Great blog by the way 🙂

  5. Taylor

    September 17, 2010 at 4:44 pm

    Great job on your first post!

  6. budi wadud

    September 17, 2010 at 10:52 pm

    nice blogg , I Learn and I’ve read, this is a good news, the boss ……… may be an invaluable experience and additional knowledge for me, as well as an introduction from me and thank you

  7. SBI Websites

    September 18, 2010 at 9:09 pm

    GREAT POST! Seriously.. I recently had a few sites down due to very similar issues. I think it was automated SQL Injections from the looks of things.. Anyhow – strong first post and good information to boot.

  8. Magento ecommerce

    September 21, 2010 at 11:30 pm

    Thanks for that very useful information. I was looking for some security method for my blog ever since I started my blog. I think my search has come to an end now. I will surely try this.

  9. Translation Agency

    September 23, 2010 at 3:11 am

    Congrats on becoming a new site owner! And thanks for the great first post 🙂

  10. Werbeagentur Bodensee

    September 23, 2010 at 6:15 am

    Thanks for sharing these tips. We are setting up a blog right now and I was concerned about security issues. Really helpful!

    Regards
    Fabian

  11. Debra

    September 23, 2010 at 6:26 am

    Thanks for that! I always appreciate not having to upload another plugin

  12. Powerfull by UspLabs

    September 23, 2010 at 11:48 am

    That seems like that code will work and doesn’t look to complicated to install. Thank you!

  13. jocuri

    September 24, 2010 at 3:36 am

    I have some problems with my wordpress .. I hope this plugin is ok

  14. Chris Wheeler

    September 25, 2010 at 5:07 am

    Nice first blog post. Internet security in general is often overlooked as unneccesary. This is a fatal mistake, and WordPress users can fall foul of prey!

  15. fantasy books

    September 25, 2010 at 10:54 pm

    More people need to know how to configure their .htaccess files. As a matter of fact, I just compared your recommended settings to my own – I need to make a few tweaks. Thanks for the informative article.

  16. Opal

    September 30, 2010 at 9:24 pm

    Wow.. useful to know, I had no idea that there was this kind of issue with WP. I once had a script injection attack on a regular html web site I was running, and my web host gave me a javascript to put in the site which would protect it from those kinds of events in the future. I don’t quite understand all the terms you use – what’s a ‘malicious URL request’? Is that an automated request sent by a bot?

  17. Kizie

    October 11, 2010 at 7:59 am

    Thanks for advice I used your practine on my page.

  18. peter

    October 13, 2010 at 6:36 am

    Its really so alarming for those like me having their blogs in the wordpress, I wonder why everyone is saying thanks to you in their comments, are these all hackers?

  19. joe brown

    October 14, 2010 at 2:01 am

    You have written very well in your post. Good job.

  20. Vin Diesel

    October 21, 2010 at 1:12 am

    This is something dangerous and can be very harmful for the wordpress users. I think wordpress should be careful about it otherwise it can have serious security problem.

  21. TheAffairLady

    October 27, 2010 at 8:16 am

    I’m constantly worried about securing my wordpress. I use the bad behavior plugin which I think is similar to the plugin in your post. I see hack attempts in my log files all the time but so far I think so good.

  22. cricket broadband

    October 28, 2010 at 2:35 am

    Your post is very useful to me. Many thanks to you!

  23. Management Consulting Firm

    October 29, 2010 at 11:18 am

    Hi nice information for the word press and thanks for sharing WordPress Security Hacks system.

  24. WhatLiveToday

    November 6, 2010 at 1:30 am

    Good post .. I like this article, very useful for me .. if you have a little time, you can visit my website.. thanks for sharing .. 🙂

  25. Vetement Grossesse

    November 9, 2010 at 1:37 am

    WordPress needs no introduction because it is currently creating lots of waves on the internet at the moment. Some people had gotten their fingers burnt by activities of some online criminals that specialize in stealing information that are in other peoples’ sites and blogs.

  26. creare site

    November 9, 2010 at 3:53 am

    You must have the latest version of WordPress if you want to be protected. This plugin seems to be very easy to use. However I prefer the protection made from the .htaccess file, exactly like in this tutorial.

  27. u10

    November 19, 2010 at 4:10 am

    well thats looks good u10 article to read, but anyway i like it as much as u10 games

  28. Britt Phillips

    November 20, 2010 at 8:47 am

    Great useful WordPress blog information. WordPress security is something every blog owner should be aware of and NOT take lightly.

  29. Jim

    November 28, 2010 at 2:09 am

    Good information on how to make a blog more secure. Thanks.

  30. Anite @ learn cloud living

    November 28, 2010 at 3:00 pm

    I will add this protection for my blogs. It’s been awhile since you wrote your first blog… hope you will come back and write some more useful information!

  31. Why My Country Sucks

    December 6, 2010 at 11:03 pm

    wow, I shall give wordpress a second look before I continue building my site!!

  32. Bold Reports

    December 7, 2010 at 4:54 am

    I will follow the instruction written here. They are awesome and much needed for newbie’s like me

  33. jocuri cu bile

    December 9, 2010 at 3:22 am

    GREAT POST! Seriously.. I recently had a few sites down due to very similar issues.

  34. Apple

    December 9, 2010 at 4:29 am

    Hey thanks for this post. It’s been helpful and enjoyable to read. Great work. Keep posting.

  35. web development

    December 13, 2010 at 9:47 pm

    i was looking for such type of informative news and i get it through your blog so i am very much thankful to you for sharing.

  36. web development

    December 13, 2010 at 10:05 pm

    really very nice information sharing and i am looking for such type of informative news and i get through this blog so i am very much thankful to you.

  37. Shailender from India Darshan

    December 15, 2010 at 12:31 am

    Many wordpress user would be benefited from this post. Good information is shared in the first blog…Keep it up.

  38. Optometrist Reno NV

    December 21, 2010 at 4:44 pm

    Yikes! Good to know…

  39. Worlds Headlines

    December 27, 2010 at 5:20 am

    Thanks I have a wordpress blog and I do not want it to be hacked. Really nice and thanks for your kind help.

  40. SamiParker

    December 29, 2010 at 6:24 am

    Its really a pleasure to be here at this site. I feel like visiting it again and again. samiparker09@gmail.com

  41. Alert 1

    January 6, 2011 at 8:31 am

    You state that this code is to “block bad queries”. What exactly does that mean? How do you define a “bad query”?

  42. Sami Parker

    January 6, 2011 at 10:01 am

    Well its really a wonderful and sort of unique one, I like the way it has shown the things, its really nice. Thanks a lot for sharing it. I would love to recommend it to others.

  43. Finally Fast

    January 7, 2011 at 1:39 pm

    Thank you for the useful information. I will use this method to secure my blog!

  44. Pferdehaftpflicht

    January 11, 2011 at 9:02 am

    nice blogg (Pferdehaftpflicht) , I Learn and I’ve read, this is a good news, the boss ……… may be an invaluable experience and additional knowledge for me, as well as an introduction from me and thank you

  45. Jetski

    January 12, 2011 at 7:35 am

    Congrats on becoming a new site owner! And thanks for the great first post 🙂

  46. Uzair

    January 12, 2011 at 9:43 am

    Nic post thanks for sharing

  47. Web Design Preston

    January 12, 2011 at 11:23 am

    I know this thread is getting old now but WordPress hacking is still a real issue. We have a large number of sites built on WordPress and many of them have been hacked as recent as the last 2 weeks. Real bad hacks as well with the database wiped and everything. It’s a pain because WordPress is such a great platform to use and very popular with our clients – they love the easy CMS. Wish we could fix WordPress hacking once and for all…!

  48. Daniel @ PHP Programmer Philippines

    January 13, 2011 at 8:09 am

    Thanks for sharing this, i just used the .htaccess method to protect my wordpress blog, I was searching for a way to protect my blog from hackers and i got into this page. 🙂

    Regards,

    Daniel

  49. E Learning Online

    January 27, 2011 at 4:32 am

    Miguel

    Thanks, I will look at the second option
    I am using these plugins on my blogs:
    Firewall
    Block Bad Queries (!) using it already
    Chap Secure Login

    highly recommended
    thanks
    Jack

  50. Vienna Souvenirs

    January 27, 2011 at 11:21 pm

    I recently came across your blog and have been reading along. I thought I would leave
    my first comment. I don’t know what to say except that I have enjoyed reading. Nice
    blog, I will keep visiting this blog very often. Take a piece of Vienna back to your home

You must be logged in to post a comment Login

Leave a Reply

Tips & Tricks

Can′t add pagination on WooThemes Thick Theme

Published

on

Everything I have tried has led to nothing. And I have tried six way’s from Sunday to get my main posts to paginate.

example one:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
query_posts('offset=1&showposts=' . get_option('woo_other_entries') . '&cat=-' . $GLOBALS['ex_asides'] . '&paged=$paged' ); ?>

example two:

<?php 
global $myOffset; 
global $wp_query;
$myOffset = 1;
$paged = intval(get_query_var('paged')) ? get_query_var('paged') : 1;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array(
	'offset' => $myOffset,
	'category__not_in' => array($GLOBALS['ex_asides'],7,84),
	'paged' => $paged,
	'showposts' => get_option('woo_other_entries'),
	)); ?>

example three:

<?php 
global $myOffset;
$myOffset = 1;
$wp_query = new WP_Query();
$wp_query->query(array(
	'offset' => $myOffset,
	'category__not_in' => array($GLOBALS['ex_asides'],7,84),
	'paged' => $paged,
	'showposts' => get_option('woo_other_entries'),
	)); ?>

And after those tries, I just can’t get more pages beyond the option’s that I choose, and can only pull an archive via the browse more link.

Any suggestions or anything?

Continue Reading

Tips & Tricks

Pulling custom fields from outside the loop

Published

on

In the last post “Creating a custom widget” I showed you how to create a custom widget. Well in this post I will show you how I used my custom widget to display all post with a certain custom field from outside the WordPress loop.

In the last post I used this tag:

<?php include(TEMPLATEPATH . '/includes/showcase.php'); ?>

Now I will show you what the file showcase.php has:

<ul>
<?php
global $wpdb;

$sql = "SELECT wposts.*
	FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
	WHERE wposts.ID = wpostmeta.post_id
	AND wpostmeta.meta_key = 'gallery-url'
	AND wposts.post_status = 'publish'
	AND wposts.post_type = 'post'
	ORDER BY wposts.post_date DESC LIMIT 8";

$pageposts = $wpdb->get_results($sql, OBJECT);
$output = $pre_HTML;

foreach ($pageposts as $post) : setup_postdata($post);  ?>

<li><a href="<?php echo get_post_meta($post->ID, "gallery-url", $single = true); ?>" title="Link to <?php the_title(); ?>">
<img src="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" alt="<?php the_title(); ?>" /></a></li>

<?php endforeach; ?>

</ul>

That’s it! The most important item you may want to change for your own custom field is the line : AND wpostmeta.meta_key = 'gallery-url'. Where you would change the text in bold to match your own custom field value.

Update:

Check out Austin from PressedWords comment below.

With his great advise I was able to figure out why all my attempts to use the query_post weren’t working. it came down to this line of code: <?php echo get_post_meta($post->ID, "gallery-url", $single = true); ?>, that was what I had in my code, and the $post->ID is the reason my code would not echo or print the custom field’s value. Solution? replace $post->ID with get_the_ID(). HA, so simple.

Continue Reading

Tips & Tricks

Creating a custom widget

Published

on

Today let’s learn a simple quick trick on how to create a custom widget. For my example I will show you how I created my Showcase widget located in the middle, to the right of the posts.

First under your functions.php file type in the following:

<?php // Custom Widget
function MyCustomWidget() { ?>
<li class="widget">
    <h2 class="heading">Latest Showcase</h2>
        <ul>
        	<?php include(TEMPLATEPATH . '/includes/showcase.php'); ?>
        </ul>
</li>

<?php }

register_sidebar_widget('The Custom Widget for Showcase', 'MyCustomWidget'); ?>
  • Always make sure your code is between the <?php and ?> for it to work.
  • Once we call the function, the rest is assuming html code that you may or may not need.
  • For instance, you may just put in a picture and call it a day. But my code starts with <li< because my sidebar’s start and end with <ul<.
  • Any way, once your done, just set the final “register_sidebar_widget('the widget title', 'the name of the function');

That’s it! Now you have a custom widget with what ever you want!

Continue Reading

Random Search Terms

Title

Recent Posts: Fully Net Worth . com

Walter Mercado Net Worth: How Rich was Walter Mercado Actually?

Walter Mercado Net Worth: How Rich was Walter Mercado Actually?

Walter Mercado also was known by his stage name as Shanti Ananda was a Puerto Rican actor, astrologer, dancer, and writer. He is best known for his shows as an astrologer where, his predictions show aired for decades in Latin American, Puerto Rico, and the United States. Walter Mercado’s net worth before his death is […]

BlameItOnKWay Net Worth: 4 Interesting Facts You Should Know

BlameItOnKWay Net Worth: 4 Interesting Facts You Should Know

Kwaylon Rogers professionally known as BlameItOnKWay is an American social media personality and comedian. Here are some facts about BlameItOnKWay including his net worth, career, sexuality and many more. 1. BlameItOnKWay net worth is estimated to be $500,000. As of 2019, BlameItOnKWay net worth is estimated to be $500,000. He earned most of his money […]

City Girls Net Worth: 5 Interesting Facts About The Hip hop duo

City Girls Net Worth: 5 Interesting Facts About The Hip hop duo

City Girls is an American hip hop duo originally from Miami which consists of the rappers Caresha Romeka Brownlee (known as Yung Miami) and Jatavia Shakara Johnson (known as JT). Here are some facts about City Girls including their net worth, career and many more. 1. City Girls has an estimated net worth of $500,000 […]

W2S net worth

W2S net worth

W2S net worth Introduction W2S is a British sports commentator on Livestream who primarily posts FIFA sports recordings and live streams for his 15 million subscribers. Online, he is known as W2S or WroeToShaw, and he is Sidemen’s youngest leader. He is also fond of Chelsea, Everton, West Ham, and Arsenal in Liverpool. Harry Lewis […]

Trending