Safety tip: whether your theme uses the automatic thumbnail script timthumb.php

WordPress sixty-one 33.8K Reading mode

The timthumb.php automatic thumbnail script can automatically cut pictures and generate thumbnails. It is mostly used for Wordpress magazine type topics. The script is widely used in foreign topics to automatically generate thumbnails, which is very convenient to use. But recently, Timthumb has exposed a serious vulnerability. Hackers can take advantage of this vulnerability (probably caused by a flaw in the verification when calling external images) to upload arbitrary malicious programs to your website, and the author's website has been hacked.

This is the author's original text: Zero Day Vulnerability in many WordPress Themes

How do I know if the theme uses the autothumbnail timthumb.php script? You can open the theme directory to check whether there is a file named timthumb.php or thumb.php and the image cache folder cache. If there is, it means that the script is loaded on the theme you are using, which may be used by hackers.

A netizen asked whether the HotNews Pro theme used the timthumb.php script. The hot news theme used this script to generate thumbnails before version 2.3, and then 2.4, 2.5, and 2.6 did not use the timthumb.php script. Instead, they used WordPress's own feature image function to generate thumbnails of locally uploaded pictures, However, themes before version 2.3 cannot be used in programs after WP3.1, so users of HotNews Pro themes need not worry about this vulnerability.

Of course, if you find that your theme uses the timthumb.php script, don't be surprised. The timthumb.php script integrated with many themes has been simplified and has no function to call external images, so this vulnerability does not exist. You can also download it here Timthumb.php script 1.33 latest version Replace the script in the topic.

PS: Although timthumb was exposed to serious vulnerabilities, I will use this script again in my next topic to generate thumbnails, because Wordpress's built-in feature image function feels like a chicken bone. The following is a comparison of the two functions:

Timthumb script Featured image function of WordPress
Whether the external chain is supported Seems to support only the images of specific websites I won't support it
Whether there is compression function Yes, and the compression ratio can be controlled Yes, but the compression ratio cannot be controlled
Store thumbnails separately sure No, it can only be put together with other attachment pictures
Whether it can be cleared Can and will automatically generate again Don't worry about losing thumbnails No, it will not be generated again after clearing
Convenience Backup website can be easily managed without backup thumbnail The thumbnail must be backed up at the same time when the website is backed up, which will cause confusion in the management of the attachment directory

Through the above comparison, The timthumb.php script is better than the feature image function provided by Wordpress in terms of use and function.

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments sixty-one    Visitors fifty-seven    Author four
    •  Kael.Z
      Kael.Z seven

      Go to the sofa~~~~

      •  satifanie
        satifanie two

        No,

        •  Hou Qibin
          Hou Qibin three

          How did you get that page. How can I make a page like yours! http://zmingcx.com/gallery/enjoy

            •  Robin
              Robin

              @ Hou Qibin The new version is not released, integrated picture template

                •  Hou Qibin
                  Hou Qibin three

                  @ Robin The image template is on that page
                  But no image template has been added

                    •  Robin
                      Robin

                      @ Hou Qibin It's not clear that the description of this function is too long

                        •  tkeelee
                          tkeelee three

                          @ Robin Ask Brother Bird about his recent message - how did I get the article archive? If I create a new page and use the archive template, it is http://www.tkeelee.com/archives/ This way. At the beginning, it seems that there was a normal effect. Later, I don't know where to change it, but it can never be changed back. Now, I have changed the new 2.7 template, which is still the same. Please ask for guidance

                            •  Bob
                              Bob five

                              @ tkeelee Don't change anything, and then try to re create the page!

                    •  Hou Qibin
                      Hou Qibin three

                      Boss, you are so complicated. I'm confused

                        •  Fragmentary thoughts
                          Fragmentary thoughts two

                          @ Hou Qibin The theme of Brother Bird can be regarded as powerful and easy to use. If you think it is very complicated and confused, I suggest you read more articles about his theme, first understand it yourself, and then ask again if you don't understand it.

                        •  U-disk data recovery
                          U-disk data recovery four

                          This problem hasn't been met. Collect it first

                          •  Wuxi takeaway
                            Wuxi takeaway one

                            I don't understand the technology, so I feel it is very difficult

                            •  miko
                              miko one

                              timthumb.php I change the theme myself sometimes!
                              But it should be OK! It's a simplified version!

                              •  Dedao SEO
                                Dedao SEO zero

                                Safety first, this will check whether other stations are used, thanks for reminding!

                                •  Recalling grass
                                  Recalling grass two

                                  I don't understand the technology, so I feel it is very difficult

                                  •  Louis Han
                                    Louis Han six

                                    My belt needs to be upgraded quickly

                                    •  Cool Sword
                                      Cool Sword two

                                      Haha, my original is the ghost of this. No wonder there are many foreign thumbnail pictures inexplicably in it. Google display may be unsafe.

                                      •  Pekko Wei
                                        Pekko Wei two

                                        Looking forward to the new version~

                                        •  Solitary Su Mo Lan
                                          Solitary Su Mo Lan three

                                          Thanks for reminding me. Go back and check it first!

                                          •  wmtimes
                                            wmtimes seven

                                            It seems that mine does. I said, why do you always send me the wrong login information to my email address.

                                            •  My Games
                                              My Games three

                                              Hehe, I hate automatic thumbnails. It takes up a lot of space. Now I send pictures by myself and read them with parameters

                                              •  Imported red wine
                                                Imported red wine one

                                                I got the auto thumbnail, and I felt that the network speed was a bit stuck

                                                •  wmtimes
                                                  wmtimes seven

                                                  The function is not powerful enough. Why don't you change it back.

                                                  •  Jining SEO
                                                    Jining SEO zero

                                                    The style of the blogger is very beautiful

                                                    •  Stock Introduction Video
                                                      Stock Introduction Video two

                                                      I don't understand the complexity

                                                      •  Beijing Wedding Photography Studio
                                                        Beijing Wedding Photography Studio one

                                                        ~~~~~! Can't hurt

                                                        •  Shantou SEO
                                                          Shantou SEO five

                                                          It's no use!

                                                          •  promise
                                                            promise zero

                                                            Simply add an index.htm to the directory

                                                            •  English jokes
                                                              English jokes two

                                                              Timthumb.php script

                                                              •  PastDust
                                                                PastDust four

                                                                Well, I was just passing by to make soy sauce

                                                                •  Pneumatic tool net
                                                                  Pneumatic tool net zero

                                                                  I'm a novice. I just passed by and didn't say anything

                                                                  •  ruantoo
                                                                    ruantoo four

                                                                    If a small blog like me goes black, why not

                                                                    •  tkeelee
                                                                      tkeelee three

                                                                      Ask Brother Bird about his recent message - how did I get the article archive? If I create a new page and use the archive template, it is http://www.tkeelee.com/archives/ This way. At the beginning, it seems that there was a normal effect. Later, I don't know where to change it, but it can never be changed back. Now I have replaced the new 2.7 template, which is still the same. Please give me some guidance

                                                                      •  Tmd
                                                                        Tmd three

                                                                        Brother Bird hasn't come back from business yet?

                                                                        •  SB
                                                                          SB zero

                                                                          Some template themes written by the blogger are very beautiful. I admire it very much. admire!

                                                                          •  My Mobile Internet
                                                                            My Mobile Internet two

                                                                            I also wanted to use your theme. Good people are using it, but taking pictures will affect the loading speed of the blog. However, it seems that many people's blogs load quickly.

                                                                            •  Ningbo Wedding Photography
                                                                              Ningbo Wedding Photography one

                                                                              I haven't visited the blog for a long time. Ha ha, here I come.

                                                                              •  Wuxi Stock Training
                                                                                Wuxi Stock Training three

                                                                                Well, good!! hey

                                                                                •  Top 10 brands of integrated stoves in China
                                                                                  Top 10 brands of integrated stoves in China zero

                                                                                  If you can pass my message, I will be there, sad or unhappy

                                                                                  •  Studio
                                                                                    Studio three

                                                                                    Although I don't understand the code, I still like it!

                                                                                    •  Sail
                                                                                      Sail zero

                                                                                      I started to learn. This script looks good!

                                                                                      •  He Chang
                                                                                        He Chang one

                                                                                        I want to get a thumbnail display function, but I don't have this script in my theme. I don't know what method to use to implement thumbnail~

                                                                                        •  Hefei SEO
                                                                                          Hefei SEO four

                                                                                          I got 2.7, but I can't use it. I'm a rookie

                                                                                          •  TT-biadu
                                                                                            TT-biadu zero

                                                                                            Brother Bird, I have studied your website for a long time. What plug-in is used for the thumbnail and summary of the articles on your blog page? It took a long time to find it

                                                                                            •  Studio
                                                                                              Studio four

                                                                                              Not bad, but I'm not familiar with PHP

                                                                                              •  maxling.net
                                                                                                maxling.net four

                                                                                                Learn ING!!

                                                                                                •  PanDaLee
                                                                                                  PanDaLee four

                                                                                                  Brother Bird can solve the security problem

                                                                                                  •  iioo
                                                                                                    iioo one

                                                                                                    Brother Bird, can you ask me a question about timthumb?
                                                                                                    I used the code in the common functions of timthumb. The default thumbnail is first, then the first image is automatically searched, and then the default image.
                                                                                                    ————————————————
                                                                                                    But my function of automatically searching for the first picture cannot be realized. Let me give you an example:

                                                                                                    This is the address of the first picture in my blog http://www.xxx.org/img/first-img.jpg , pictures are uploaded through the background.

                                                                                                    But only the red cross is displayed on the thumbnail. The address of the red cross is: http://www.xxx.org/ Topic address/timthumb.php? src= http://www.xxx.org/cache/first-img.jpg&h=95&w=150&zc=1
                                                                                                    Why is this?
                                                                                                    ——————
                                                                                                    Thank you, Brother Bird!!:) This timthumb problem has been bothering me for many days. I have read a lot of materials, but I can't solve it. Brother Bird, please help me!! Thanks again!!!

                                                                                                    ——————

                                                                                                      •  Robin
                                                                                                        Robin

                                                                                                        @ iioo You can refer to HotNews pro topic version 2.33, which uses this function

                                                                                                        •  Tokin
                                                                                                          Tokin two

                                                                                                          @ iioo I am also involved in this problem

                                                                                                        •  iioo
                                                                                                          iioo one

                                                                                                          Related codes I use:
                                                                                                          else {
                                                                                                          $post_timthumb = ”;
                                                                                                          ob_start();
                                                                                                          ob_end_clean();
                                                                                                          $output = preg_match(‘//i’,$post->post_content, $index_matches);
                                                                                                          $first_img_src = $index_matches [1];
                                                                                                          if( ! empty($first_img_src) ){
                                                                                                          $path_parts = pathinfo($first_img_src);
                                                                                                          $first_img_name = $path_parts[“basename”];
                                                                                                          $first_img_pic = get_bloginfo(‘wpurl’).’/ cache/’.$first_img_name;
                                                                                                          $first_img_file = ABSPATH. ‘ Cache/'. $first_img_name;//Save the address
                                                                                                          $expired = 604800; // Thumbnail expiration time
                                                                                                          Continue

                                                                                                          •  iioo
                                                                                                            iioo one

                                                                                                            Code continued

                                                                                                            if ( ! is_file($first_img_file) || (time() -filemtime($first_img_file)) > $expired ){
                                                                                                            copy($first_img_src, $first_img_file);
                                                                                                            $post_timthumb = ‘post_title.\'” />’;
                                                                                                            }
                                                                                                            $post_timthumb = ‘post_title.\'” class=”attachment-post-thumbnail”/>’;
                                                                                                            }

                                                                                                            •  aytvnet
                                                                                                              aytvnet zero

                                                                                                              http://www.guatji.com/ Test how Brother Bird can prevent garbage from being out of the chain

                                                                                                              •  hoythan
                                                                                                                hoythan three

                                                                                                                Timthumb.php didn't call the external image function
                                                                                                                How can I set it?
                                                                                                                I use cloud storage - it's helpless to call

                                                                                                                  •  linux
                                                                                                                    linux zero

                                                                                                                    @ hoythan It can be called. Please refer to this http://my.oschina.net/u/218746/blog/81739

                                                                                                                  •  Kaikai
                                                                                                                    Kaikai one

                                                                                                                    How can I use this to avoid being exploited by hackers

                                                                                                                    •  I love books
                                                                                                                      I love books five

                                                                                                                      There is really a big loophole

                                                                                                                      •  fly
                                                                                                                        fly zero

                                                                                                                        Solve the problem that WordPress Timthumb.php thumbnails are occasionally not displayed
                                                                                                                        http://lfei.org/wordpress-timthumb-display/

                                                                                                                       anonymous

                                                                                                                      Comment

                                                                                                                      Anonymous netizens
                                                                                                                       :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

                                                                                                                      Drag the slider to complete validation