< Return to Video

#rC3 Very Pwnable Network (VPN)

  • 0:00 - 0:04
    [Translated by {Iikka}{Yli-Kuivila}
    (ITKST56 course assignment at JYU.FI)]
  • 0:04 - 0:31
    33C3 preroll music
  • 0:31 - 0:35
    Herald: Welcome back to the festival
    stage, still day two according to my
  • 0:35 - 0:41
    clock, even though I have lost all sense
    of time by now, I don't know. It's like a
  • 0:41 - 0:45
    kind of rush year with so many great
    talks, and we'll have the next super
  • 0:45 - 0:53
    awesome talk held by Jiska, Gerbert and
    Matthias. And those three lovely people
  • 0:53 - 1:00
    will be showing us something about VPNs.
    So-called very pwnable networks and why
  • 1:00 - 1:06
    your VPN might not be as secure as you
    think or have been led to believe. And
  • 1:06 - 1:11
    this is not only important for the people
    that think like, haha, I'm behind seven
  • 1:11 - 1:16
    proxies. You can't catch me. But also,
    maybe if your employer says, please use
  • 1:16 - 1:21
    this VPN client and there might be some
    surprises waiting for you. And this is
  • 1:21 - 1:26
    again, a pre-recording, and afterwards I
    can already see them here in our tools,
  • 1:26 - 1:32
    but afterwards we will do a Q&A session.
    So if you have any questions, put them
  • 1:32 - 1:41
    into the IRC or on Twitter or Mastodon
    with the hashtag #rc3cwtv. And our lovely
  • 1:41 - 1:46
    Signal Angel will collect them and we'll
    see each other after the pre-recording.
  • 1:46 - 1:48
    Jiska: Everyone and welcome to the talk
  • 1:48 - 1:56
    Very Pwnable Network which is by Gerbert,
    Matthias and me. So how did all start?
  • 1:56 - 2:02
    Well, I got a little bit paranoid last
    year and I just thought it might be a good
  • 2:02 - 2:09
    idea to encrypt a lot because Wi-Fi, LTE,
    TLS it might be intercepted, might be
  • 2:09 - 2:14
    decrypted. So we should encrypt like
    everyone is watching and so I should use a
  • 2:14 - 2:20
    VPN on top. And then the next trust
    assumption was that I connect to my
  • 2:20 - 2:27
    university's network every day, so I
    should trust this one anyway. And if I
  • 2:27 - 2:31
    trust this network, then I could also use
    this network and their professional VPN
  • 2:31 - 2:36
    service. I hear you laughing, I hear
    laughing but so this was my idea because
  • 2:36 - 2:43
    then there is no additional thing that I
    trust during my network activity. And
  • 2:43 - 2:48
    well, they had this nice AnyConnect line
    that just works on all operating systems.
  • 2:48 - 2:53
    So it also sounds like a great product
    name for a secure product like AnyConnect.
  • 2:53 - 3:00
    Yeah. And then I started using this on my
    mobile devices, right? And then suddenly I
  • 3:00 - 3:06
    got crash logs and it looked like this. So
    I mean, if you're paranoid, you obviously
  • 3:06 - 3:12
    look into your crash logs every two days
    and one of these crash logs was this one.
  • 3:12 - 3:17
    It didn't really look nice the address
    looks a bit strange, and you also have
  • 3:17 - 3:22
    some trace of the crashed thread. And if
    you log this into IDA and do a little bit
  • 3:22 - 3:26
    of reverse engineering, you can also add
    some function names in the AnyConnect
  • 3:26 - 3:32
    extension, the AC extension and the crash
    is somewhere when it applies VPN config
  • 3:32 - 3:37
    somewhere in the - in the tunnel buffers.
    I don't know. So - and then also, the
  • 3:37 - 3:44
    address looks strange because the address
    is IP version four backwards and then a
  • 3:44 - 3:52
    few days later I got another crash and
    this crash read like 68k New Line. And so
  • 3:52 - 3:57
    it really looked like some configuration
    strings that were crashing at certain
  • 3:57 - 4:02
    addresses, so it really didn't look good.
    But I also didn't have that much time. So
  • 4:02 - 4:07
    I just wrote Cisco and said, like, so do
    you mean to serious like, is your client
  • 4:07 - 4:13
    really crashing that often? Because every
    time I do my laundry, I have bad Internet
  • 4:13 - 4:20
    connectivity, so my any - my AnyConnect
    client starts to crash at weird addresses.
  • 4:20 - 4:27
    And while this is like an issue for code
    execution, the other issue is that if you
  • 4:27 - 4:31
    just jam a few packets over the air, then
    an attacker might be able to disconnect
  • 4:31 - 4:38
    the victim from a VPN. So that is also an
    issue. So because the AnyConnect client is
  • 4:38 - 4:44
    not properly included in the operating
    system iOS, and that means that you would
  • 4:44 - 4:48
    just reconnect and send your messages in
    plaintext over the network and the user
  • 4:48 - 4:52
    does not get any notification. It's just a
    VPN symbol that has gone and all traffic
  • 4:52 - 4:58
    is sent in plaintext. And I wanted to
    analyze this a little bit further and
  • 4:58 - 5:02
    there is a debugging option in the
    AnyConnect client. But since it's in the
  • 5:02 - 5:07
    client that crashes, the logs are just
    gone. If you have a crash and even worse
  • 5:07 - 5:12
    also the operating system crash logs in
    iOS are missing if you have the debugging
  • 5:12 - 5:19
    option enabled. And well they answered:
    "We cannot reproduce this". I mean,
  • 5:19 - 5:24
    obviously they didn't help me with my
    laundry or anything so they could not
  • 5:24 - 5:30
    reproduce. And even worse, they ignored
    the ticket for a long time until we said
  • 5:30 - 5:37
    we are going to present this at this
    year's CCC congress. And then 10 days
  • 5:37 - 5:41
    before the talk they claimed that they had
    fixed two out of the three crashes and
  • 5:41 - 5:44
    were asking if we could reproduce the
    crashes or not. But just a day before they
  • 5:44 - 5:52
    said like they were not sure and so on. So
    it was really a weird ticket there and I
  • 5:52 - 5:55
    have no idea if things are fixed or not,
    because to reproduce, I obviously need
  • 5:55 - 6:00
    like tinfoil. I need like a couple of
    smart phones with the AnyConnect client
  • 6:00 - 6:04
    installed, and then I need to walk around
    and hope that the Internet connection
  • 6:04 - 6:08
    breaks and that it breaks in a way that
    produces a crash. So this is just way too
  • 6:08 - 6:17
    random. I also told Apple and Apple just
    said, Well, the issue is that the client
  • 6:17 - 6:22
    crashes so it's not really their
    department, even though it's the network
  • 6:22 - 6:29
    extension that crashes. So it's not their
    task here to notify the user. It's just
  • 6:29 - 6:33
    the VPN that is gone. And then you send
    data in plaintext and this is all right.
  • 6:33 - 6:41
    This is the expected behavior. So I got a
    bit annoyed and stopped using VPNs, but I
  • 6:41 - 6:47
    also had the idea to find students who
    might look into this. And well, you know
  • 6:47 - 6:52
    what happens when you find very motivated
    students, they find vulnerabilities. And
  • 6:52 - 6:55
    this is what this talk is going to be
    about.
  • 6:55 - 7:00
    Gerbert: So we had a look at the Cisco
    AnyConnect client for Linux and found some
  • 7:00 - 7:04
    interesting things. Shortly after
    publishing our findings, several news
  • 7:04 - 7:10
    articles popped up. But what happened
    between the crashes of Jiska and these
  • 7:10 - 7:18
    articles? VPN is interesting because it is
    such an old research topic. However, the
  • 7:18 - 7:23
    importance of the technology was later
    increased by the corona pandemic. Many
  • 7:23 - 7:30
    companies had to relocate to home offices
    to meet the safety measures. VPN allows
  • 7:30 - 7:36
    users from outside to access internal
    resources of the company or university. To
  • 7:36 - 7:43
    connect to a VPN server, additional client
    software is usually required. Besides open
  • 7:43 - 7:49
    source products, such as openVPN, a lot
    of closed source software is offered on
  • 7:49 - 7:55
    the market. Especially in the enterprise
    sector. The users are forced to trust this
  • 7:55 - 8:02
    software, install a black box in their
    system in order to connect to a network.
  • 8:02 - 8:09
    AnyConnect secure mobility client from
    Cisco is an enterprise software solution.
  • 8:09 - 8:14
    AnyConnect can be classified as a remote
    access client that allows end-users to
  • 8:14 - 8:22
    connect to a network that supports SSL VPN
    and also IPsec. When using SSL VPN the
  • 8:22 - 8:30
    authentication and the establishment of a
    VPN tunnel is carried out via an SSL or
  • 8:30 - 8:36
    TLS tunnel. The software acts as a fat
    client that communicates with the VPN
  • 8:36 - 8:42
    server via HTTPS. As already mentioned the
    source code for AnyConnect is not publicly
  • 8:42 - 8:48
    available. The application is distributed
    with compiled binaries and libraries.
  • 8:48 - 8:54
    Although the application is documented, it
    does not cover internal functionality.
  • 8:54 - 8:59
    Even the vulnerability disclosures, which
    are published in public advisories, do not
  • 8:59 - 9:05
    go into much technical detail. Therefore
    there is only limited knowledge about the
  • 9:05 - 9:11
    application and its internal behavior. We
    have set ourselves the goal to examine
  • 9:11 - 9:20
    AnyConnect for Linux and iOS in a recent
    version. The main functionality of
  • 9:20 - 9:25
    AnyConnect is the establishment of VPN
    connections, but this is only the tip of
  • 9:25 - 9:32
    the iceberg. AnyConnect also connects
    numerous other features, to name a few:
  • 9:32 - 9:37
    The distribution and execution of scripts
    on host systems, automatically updating
  • 9:37 - 9:43
    the software without asking the user for
    permission. Another feature is host scan:
  • 9:43 - 9:49
    it does not integrate into AnyConnect, but
    it is considered as a standalone software.
  • 9:49 - 9:54
    It works together with the AnyConnect
    infrastructure and makes it possible to
  • 9:54 - 10:01
    read out extensive system information of
    the host and transmit them to VPN server.
  • 10:01 - 10:09
    The related work of AnyConnect is based on
    Cisco's public advisories and blog entries
  • 10:09 - 10:15
    from certain security researchers.
    Therefore, we decided to list and
  • 10:15 - 10:21
    categorize all vulnerabilities since 2011.
    On this diagram, we see a list of
  • 10:21 - 10:27
    vulnerabilities per year, ordered by
    severity. Most of the time reported
  • 10:27 - 10:33
    vulnerabilities are classified as medium,
    but even critical vulnerabilities were
  • 10:33 - 10:44
    disclosed in 2011 and 2012. The increased
    numbers in 2015 and 2016 caused numerous
  • 10:44 - 10:51
    vulnerabilities of libraries such as
    OpenSSL. The vulnerabilities were then
  • 10:51 - 10:57
    divided into categories and illustrated in
    the diagram. Cryptographic vulnerabilities
  • 10:57 - 11:04
    are the most common as AnyConnect uses
    OpenSSL and vulnerabilities in OpenSSL are
  • 11:04 - 11:10
    also vulnerabilities in AnyConnect.
    However, excluding the third-party
  • 11:10 - 11:16
    vulnerabilities, the category of most
    vulnerabilities affecting AnyConnect would
  • 11:16 - 11:22
    be privilege escalations. Closely followed
    by denial of service attacks, which are
  • 11:22 - 11:26
    often directed against the running
    application in order to disrupt the VPN
  • 11:26 - 11:33
    connection. Overflow vulnerabilities or
    version downgrades
  • 11:33 - 11:38
    These results gave us a little insight
    about the flaws of the past.
  • 11:38 - 11:43
    Matthias: So before we will pass over to
    the reversing parts, we want to give you a
  • 11:43 - 11:51
    quick experience report regarding Cisco's
    licensing support. Cisco ASA is a typical
  • 11:51 - 11:56
    server endpoint for Cisco AnyConnect,
    which is available as hardware appliance
  • 11:56 - 12:03
    and also as a virtual version running on,
    for example, VMware. At the beginning of
  • 12:03 - 12:08
    our research, we tried to obtain an
    official evaluation license for Cisco
  • 12:08 - 12:14
    ASAv, while never hiding the purpose of
    wanting to use it for security research.
  • 12:14 - 12:21
    Therefore our naive approach was to just
    write the Cisco licensing support. It was
  • 12:21 - 12:26
    more or less like: Hi, we are doing
    security research on the Cisco AnyConnect
  • 12:26 - 12:32
    clients. Could you offer us free evalution
    licenses for Cisco ASAv? Cisco replied:
  • 12:32 - 12:38
    Sure. Please let me know the amount of
    licenses that you need. At that point, we
  • 12:38 - 12:43
    were a bit surprised because it just
    seemed a bit too easy. But then we had
  • 12:43 - 12:50
    three 60-day licenses added to our
    account. But as soon as we tried to
  • 12:50 - 12:56
    download the ASAv image for VirtualBox, we
    got this error. Maybe some kind of error
  • 12:56 - 13:01
    on the license was not applied correctly,
    because if you have the license for
  • 13:01 - 13:06
    products, you can of course download it,
    right? Um yeah, but it seemed that our
  • 13:06 - 13:11
    approach was a little bit naive and we
    underrated the complexity of enterprise
  • 13:11 - 13:21
    software licensing. So it was a bit
    unsatisfying. But we had an idea. We asked
  • 13:21 - 13:26
    the data center of our university for help
    as university was using Cisco AnyConnect
  • 13:26 - 13:33
    too. But we never got any response. We
    still had some options, but at some point
  • 13:33 - 13:39
    we just gave up.
    G: As there is no proper documentation for
  • 13:39 - 13:44
    AnyConnect yet, it was initially necessary
    to understand the application and to
  • 13:44 - 13:50
    filter out its central components.
    Therefore, we had no choice but to reverse
  • 13:50 - 13:59
    engineer the application. We analyzed the
    application files and network traffic.
  • 13:59 - 14:04
    In order to better understand the applica-
    tion we used standard tools like Ghidra
  • 14:04 - 14:10
    for static code analysis. The Ghidra is
    able to decompile the source code of the
  • 14:10 - 14:16
    compiled binary or library. For dynamic
    application analysis we used tools like
  • 14:16 - 14:23
    Frida, Burp and Wireshark. Frida can be
    used to attach to running processes and to
  • 14:23 - 14:28
    understand the program flow. Burp was used
    as a proxy to view and modify https
  • 14:28 - 14:36
    messages, and Wireshark is used to capture
    and decrypt message traffic. Let's take a
  • 14:36 - 14:41
    closer look at the binaries of all the
    files first. AnyConnect comes with a large
  • 14:41 - 14:46
    number of binaries. While reversing we
    could identify three central parts of the
  • 14:46 - 14:52
    application: vpnui is a binary a user
    interacts with. It offers the graphical
  • 14:52 - 14:59
    user interface, where the user can make
    simple settings or initiate a VPN
  • 14:59 - 15:05
    connection. The second binary is
    vpnagentd. It runs as a daemon in the
  • 15:05 - 15:12
    background at all times, even when no VPN
    connection is open. The special thing
  • 15:12 - 15:18
    about vpnagentd is that it runs as a root
    process and always listens on a static
  • 15:18 - 15:25
    port. Its purpose is to set up the VPN
    tunnel and the network configuration of
  • 15:25 - 15:33
    the host system. This includes setting up
    routes or DNS servers. The third and last
  • 15:33 - 15:38
    binary is the vpndownloader. As the name
    hints, the purpose of the binary is to
  • 15:38 - 15:44
    download additional files when
    establishing a VPN connection. This
  • 15:44 - 15:51
    includes VPN profiles, help files and
    scripts. The binary exchanges data with
  • 15:51 - 16:00
    each other via inter-process communication
    or short IPC. The IPC takes place via TCP
  • 16:00 - 16:06
    sockets. The binary data format for - that
    Cisco has defined is used to exchange the
  • 16:06 - 16:16
    messages on the TCP sockets. In addition
    to the binaries, AnyConnect also contains
  • 16:16 - 16:21
    numerous libraries. Many of them are ports
    of existing open source libraries like
  • 16:21 - 16:30
    OpenSSL. The most important libraries are
    shown on this slide: libvpnapi.so contains
  • 16:30 - 16:36
    interfaces and functions for the backend
    logic of user interfaces. The goal of the
  • 16:36 - 16:41
    library is that it com - that companies
    can create their own VPN applications
  • 16:41 - 16:47
    using the AnyConnect infrastructure. It is
    the only library for which documentation
  • 16:47 - 16:54
    is actually provided by Cisco.
    Libvpncommoncrypt serves as a wrapper for
  • 16:54 - 17:01
    OpenSSL and NSS libraries. NSS is similar
    to OpenSSL and is used by browsers like
  • 17:01 - 17:08
    Mozilla Firefox to enable SSL and TLS
    connections. It also provides its own
  • 17:08 - 17:17
    certificate store. Libvpncommon is another
    central library used by all binaries. It
  • 17:17 - 17:23
    provides classes and functions for the IPC
    logic. It can be used to create, send or
  • 17:23 - 17:30
    validate lPC messages. The next library,
    libvpnagentutilities, contains classes and
  • 17:30 - 17:37
    functions that handle critical operations,
    such as host network settings. This
  • 17:37 - 17:45
    library is only used by vpnagentd. Besides
    the binaries and libraries there are a
  • 17:45 - 17:52
    variety of other relevant files that we
    have taken a closer look at. AnyConnect
  • 17:52 - 17:59
    offers an AnyConnect local policy XML
    file. This file regulates various security
  • 17:59 - 18:04
    configurations. For instance, it can be
    used to specify that no further files may
  • 18:04 - 18:12
    be downloaded or that version updates may
    be carried out by a VPN server. In its
  • 18:12 - 18:16
    default configuration it is very
    permissive so that almost everything is
  • 18:16 - 18:21
    allowed. The file is not overwritten by
    updates and cannot be modified by VPN
  • 18:21 - 18:31
    servers. The VPN profile is also in XML
    format: it contains further settings. The
  • 18:31 - 18:37
    green highlighted line shows an
    EnableScripting-tag with a boolean value
  • 18:37 - 18:44
    of false. Indicating that scripts should
    not be executed by the host system.
  • 18:44 - 18:50
    Profile files are distributed by a VPN
    server. And are overwritten the next time
  • 18:50 - 19:00
    a user connects and changes them. The last
    file is VPNManifest.dat which has a binary
  • 19:00 - 19:06
    data format that contains the version
    number of AnyConnect. This file is used to
  • 19:06 - 19:12
    check the installed version of AnyConnect
    before an version update. In addition to
  • 19:12 - 19:19
    all these files, the message traffic also
    plays a central role. The establishment of
  • 19:19 - 19:25
    a VPN connection is structured in three
    phases. Phase one is the authentication.
  • 19:25 - 19:34
    The user enters the IP or domain of a VPN
    server in vpnui. The target server is then
  • 19:34 - 19:41
    sent via IPC message to vpnagentd. As a
    response vpnui receives various system
  • 19:41 - 19:49
    information back. This includes the
    operating system or a whole study.
  • 19:49 - 19:54
    Afterwards this information and the
    credentials are sent to the VPN server
  • 19:54 - 20:04
    with HTTPS. The ASA returns server
    parameters in a HTTPS response. Let's take
  • 20:04 - 20:10
    a closer look at the request and the
    response. On the left side, you can see
  • 20:10 - 20:16
    the request. It is an ordinary post
    request with an XML in which the
  • 20:16 - 20:22
    credentials are transferred. The
    credentials are marked in green.
  • 20:22 - 20:28
    On the right side we see the response. The
    response contains the session token, which
  • 20:28 - 20:33
    is also marked in green. In addition, the
    response contains the URLs to all
  • 20:33 - 20:40
    downloadable files and the hashes. The
    orange marked string is one of the
  • 20:40 - 20:48
    downloadable files. The download phase is
    the second phase of the VPN connection set
  • 20:48 - 20:56
    up. First vpnui executes the vpndownloader
    binary. Then the server parameters from
  • 20:56 - 21:03
    the previous HTTPS response are
    transferred to the vpndownloader via IPC.
  • 21:03 - 21:10
    The URLs are extracted from the IPC
    message and when the files are downloaded
  • 21:10 - 21:18
    to a temporary directory via HTTPS. The
    downloader process informs the vpnagentd
  • 21:18 - 21:24
    via IPC to move the files to the
    application directory. In the third and
  • 21:24 - 21:31
    final phase of VPN connection set up,
    vpnui sends an IPC message to vpnagentd
  • 21:31 - 21:37
    with the request to establish a VPN
    tunnel. Subsequently, the exchange of
  • 21:37 - 21:44
    tunnel parameters takes place via HTTPS.
    After the parameters have been set by
  • 21:44 - 21:51
    vpnagentd the VPN session continues. Let's
    take a closer look at the tunnel
  • 21:51 - 21:58
    parameters. On the left side, we can see
    the request. In the first line you can
  • 21:58 - 22:04
    observe the HTTP connect method. Usually
    this method is used to proxies to forward
  • 22:04 - 22:10
    the request to the target server. Within
    the request, the session token is
  • 22:10 - 22:16
    specified in the cookie header. This is
    the same session token we received in the
  • 22:16 - 22:22
    authentication phase. The different tunnel
    parameters transmitted in separate HTTP
  • 22:22 - 22:30
    headers. The part marked in red represents
    the local IP address of the host. On the
  • 22:30 - 22:36
    right, you can see a response to the
    request. For example, the X-CSTP-Address
  • 22:36 - 22:43
    header contains the IP address that the
    host should apply on its tunnel interface.
  • 22:43 - 22:50
    In the part marked in red we now also see
    the DNS server for the VPN
  • 22:50 - 22:56
    connection. In addition, the address
    ranges that should be routed via the VPN
  • 22:56 - 23:04
    server as specified in the X-CSTP-Split-
    Include header. Now that we have a general
  • 23:04 - 23:10
    understanding of the application, let's
    move on to the vulnerability research. We
  • 23:10 - 23:16
    have performed an design analysis for
    AnyConnect in which we looked at the IPC
  • 23:16 - 23:22
    messages in more detail. We need to define
    certain security assumptions and an
  • 23:22 - 23:26
    attacker model before we search for
    vulnerabilities. This slide shows several
  • 23:26 - 23:33
    of our assumptions. Cryptographic
    algorithms within the application are
  • 23:33 - 23:39
    considered secure and cannot be broken in
    exponential time. An attacker cannot read
  • 23:39 - 23:45
    or modify messages regardless of their
    position, and we assume that the VPN
  • 23:45 - 23:51
    server does not pursue any malicious
    intent and only sends valid messages that
  • 23:51 - 23:57
    are protocol compliant. We assume a local
    attacker who is already able to execute
  • 23:57 - 24:01
    commands on the system and the attackers
    goal is to compromise the confidentiality,
  • 24:01 - 24:08
    integrity and availability of the system
    or application. Privilege escalation
  • 24:08 - 24:14
    vulnerabilities are also covered since
    they allow an attacker to compromise these
  • 24:14 - 24:21
    three security objectives. Cisco decided
    to include an auto update feature in the
  • 24:21 - 24:28
    application. AnyConnect is able to receive
    AnyConnect updates through a VPN server
  • 24:28 - 24:32
    without any user interaction. In its
    default configuration AnyConnect can be
  • 24:32 - 24:39
    updated by a VPN server that offers a
    newer version. From a security
  • 24:39 - 24:45
    researcher's perspective auto update
    sounds promising, right? So let's take a
  • 24:45 - 24:50
    closer look at the auto update feature.
    First, the vpndownloader downloads an
  • 24:50 - 24:57
    executable installer and the shell script
    called vpndownloader.sh. Then
  • 24:57 - 25:04
    vpndownloader.sh is executed. The Shell
    script contains an archive and unpacks
  • 25:04 - 25:09
    itself to extract a new version of the
    vpndownloader. An IPC message is then sent
  • 25:09 - 25:16
    to the vpnagentd asking it to start the
    installer. The vpnagentd does not start
  • 25:16 - 25:21
    the installer directly. Instead the
    vpnagentd calls the vpndownloader with
  • 25:21 - 25:28
    root privileges, which in turn calls the
    installer. Before executing the installer
  • 25:28 - 25:35
    vpndownloader verifies and validates it.
    We got an idea: Is it possible to install
  • 25:35 - 25:41
    an outdated version through forged IPC
    messages? As shown in the picture the
  • 25:41 - 25:48
    attacker needs an old signed installer and
    sends the IPC message to vpnagentd asking
  • 25:48 - 25:54
    to execute the old installer. The
    vpnagentd calls the vpndownloader as
  • 25:54 - 25:59
    usual, which in turn calls the attacker's
    installer. There is no check whether the
  • 25:59 - 26:05
    installer is more recent than the
    installed version. This makes the version
  • 26:05 - 26:11
    downgrade therefore possible. The
    advantage of downgrading to an outdated
  • 26:11 - 26:16
    version is that an attacker could force
    the installation of a version which
  • 26:16 - 26:21
    suffers from security vulnerabilities and
    the attacker could then exploit these
  • 26:21 - 26:29
    vulnerabilities. We reported the
    vulnerability to Cisco's product incident
  • 26:29 - 26:34
    response team and it was fixed at the end
    of September. The vulnerability only
  • 26:34 - 26:42
    received a CVSS score of 3.1 and was
    therefore rated with a low severity. The
  • 26:42 - 26:48
    vulnerability was only exploitable in the
    Linux version. Windows and Mac versions
  • 26:48 - 26:55
    were already secured against such an
    attack. Another functionality we had - we
  • 26:55 - 27:00
    have looked into is the deployment and
    execution of scripts. They call it "Bring
  • 27:00 - 27:06
    your own script". This functionality is
    intended to deploy very helpful scripts to
  • 27:06 - 27:11
    staff computers. In order for a script to
    be executed, it must meet two criterias.
  • 27:11 - 27:17
    First, it must be located in the script
    folder and begin with OnConnect or
  • 27:17 - 27:24
    OnDisconnect as a file name. Second, the
    EnableScripting tag in profile which is
  • 27:24 - 27:32
    sent by the server must be set to true.
    Depending on the file name, scripts are
  • 27:32 - 27:37
    triggered after VPN connection is
    established and terminated. As VPN server
  • 27:37 - 27:43
    can distribute profiles in which the
    execution of scripts is enabled and also
  • 27:43 - 27:48
    distributes the scripts: these two in
    combination allow VPN server to gain
  • 27:48 - 27:54
    remote code execution on the connecting
    clients. This functionality poses a major
  • 27:54 - 27:59
    problem because humans often need to trust
    the university's VPN servers and have no
  • 27:59 - 28:06
    other choice. But let's take a closer look
    at the distribution of the scripts. Here
  • 28:06 - 28:12
    we see the classic procedure of a script
    distribution. In the download phase,
  • 28:12 - 28:19
    vpndownloader downloads an OnConnect or an
    OnDisconnect script. Then vpndownloader
  • 28:19 - 28:25
    asks with IPC message to move the
    downloaded script to the script folder.
  • 28:25 - 28:33
    The vpnagentd process calls the
    vpndownloader, which then moves the file.
  • 28:33 - 28:37
    We systematically examined the IPC
    messages and found a vertical privilege
  • 28:37 - 28:43
    escalation. An attacker is able to send
    the same message to the vpnagentd process.
  • 28:43 - 28:48
    Any of the attacker's scripts can be moved
    into the script directory. If there is
  • 28:48 - 28:53
    already a script in the script folder, it
    is simply overwritten. If the attacker
  • 28:53 - 28:59
    moves On, an OnDisconnect script while
    the user is already - has a VPN connection
  • 28:59 - 29:05
    open, the script is executed with user
    privileges. When the VPN connection is
  • 29:05 - 29:13
    closed, first unprivileged user can obtain
    code execution context of another user.
  • 29:13 - 29:18
    What bothered us about our attack was that
    it is - was tied to conditions. One of the
  • 29:18 - 29:24
    conditions was that the EnableScripting
    tag must have the boolean value "True". We
  • 29:24 - 29:29
    considered other attack scenarios and came
    up with the idea of distributing a profile
  • 29:29 - 29:35
    ourselves. So we check for the tag again,
    but create not only a script, but also a
  • 29:35 - 29:41
    VPN profile that allows scripting. The
    attack works as follows: while a local
  • 29:41 - 29:46
    user has a VPN session active, another
    user on the system creates a malicious
  • 29:46 - 29:51
    script and a new profile. The new profile
    contains the EnableScripting tag set to
  • 29:51 - 29:57
    "True". The attacker then sends an IPC
    message to the vpnagentd requesting to
  • 29:57 - 30:03
    copy the script to the script directory.
    The vpndownloader is then started with
  • 30:03 - 30:11
    root permissions to perform the copy
    operation. Also, the attacker can send an
  • 30:11 - 30:17
    additional IPC message to vpnagentd
    requesting to overwrite the
  • 30:17 - 30:25
    existing profile with a malicious profile.
    Although the profile is overwritten the
  • 30:25 - 30:29
    settings of a new profile are not applied
    yet, because the old profile is still
  • 30:29 - 30:35
    active. However, we were able to determine
    that the new profile is loaded when
  • 30:35 - 30:42
    there's a reconnect on the VPN session.
    Reconnects are actually quite common in
  • 30:42 - 30:46
    the AnyConnect. If reconnect happens the
    new profile is loaded and applied. In our
  • 30:46 - 30:51
    case, it enables the scripting feature.
    After teardown of a VPN connection the
  • 30:51 - 30:56
    malicious OnDisconnect script of the
    attacker is executed with the privileges
  • 30:56 - 31:03
    of the user running the VPN client. Both
    problems were reported to Cisco, but could
  • 31:03 - 31:08
    not be fixed by the disclosure date.
    Although we extended the disclosure
  • 31:08 - 31:12
    deadline. As of today the vulnerability is
    still present with the default
  • 31:12 - 31:18
    configuration of AnyConnect. Cisco
    published this vulnerability with a CVSS
  • 31:18 - 31:26
    of 7-1, 7.1, which is considered as a high
    severity. Because it was published on the
  • 31:26 - 31:32
    4th of November 2020 without a fix, the
    vulnerability got major attention in many
  • 31:32 - 31:42
    news sites. Various sites reported the
    vulnerability. The quality of reports
  • 31:42 - 31:47
    varied. Some of the articles contained
    incorrect information, for example, it was
  • 31:47 - 31:53
    stated that an exploit was already in
    circulation. It is not accurate since we
  • 31:53 - 31:58
    are the only ones who have a working
    exploit and have not published it yet. We
  • 31:58 - 32:03
    could not find any other exploit on the
    Internet either. I think that the way of
  • 32:03 - 32:10
    reporting - this way of reporting has to
    be reconsidered because it has caused a so
  • 32:10 - 32:15
    wrong assessment of vulnerability. We were
    even contacted by some incident response
  • 32:15 - 32:21
    teams that were worried about their
    infrastructure. All vulnerabilities found
  • 32:21 - 32:25
    and reported are listed in the table
    below. The three vulnerabilities were
  • 32:25 - 32:30
    found by design analysis. Only one of the
    vulnerabilities is fixed, according to
  • 32:30 - 32:38
    Cisco. Especially the Bring Your Own
    Script vulnerabilities have already been
  • 32:38 - 32:43
    published, although no fix is available
    for them, a workaround has been declared
  • 32:43 - 32:50
    to fix the vulnerabilities. By modifying
    the local policy file the download phase
  • 32:50 - 32:54
    can be skipped completely. Since the
    latest update it's also possible to
  • 32:54 - 33:00
    prohibit the download and deployment of
    scripts on a modular basis.
  • 33:00 - 33:05
    M: And what about mobile platforms? Do our
    discovered vulnerabilities also apply
  • 33:05 - 33:12
    here? Let's make it quick. No. Mobile
    platforms are lacking many features
  • 33:12 - 33:16
    compared to the Linux, Windows and macOS
    versions. You're, of course, able to
  • 33:16 - 33:21
    establish TLS and IPsec connections, just
    like with all the other clients. But
  • 33:21 - 33:25
    because features like the deployment of
    custom scripts or auto update is missing,
  • 33:25 - 33:30
    there's no way of using these exploits on
    mobile platforms. We are currently having
  • 33:30 - 33:35
    a look into the iOS implementation of
    AnyConnect and therefore want to give you
  • 33:35 - 33:41
    a quick and high level overview into the
    architecture. As we are dealing with Apple
  • 33:41 - 33:46
    here, serious stuff like the
    implementation of the VPN is a bit
  • 33:46 - 33:52
    different compared to, for example, the
    Linux client. If you want to mess with
  • 33:52 - 33:56
    notifications, add sharing buttons or
    create a widget on the homescreen, you
  • 33:56 - 34:02
    have to use an app extension. Equally for
    VPN functionality, you have to use the
  • 34:02 - 34:08
    network extension framework. The network
    extensions contain providers and features
  • 34:08 - 34:14
    for all kind of network related operations
    like for content filtering, DNS, Wi-Fi and
  • 34:14 - 34:19
    more. If you want to build your own VPN
    app, you have to choose between the
  • 34:19 - 34:26
    Personal VPN, the Packet Tunnel Provider
    and the App Proxy Provider. In our case
  • 34:26 - 34:30
    the AnyConnect on iOS implements the
    Packet Tunnel Provider as they are using
  • 34:30 - 34:38
    their own packet oriented protocol. Here
    you can see the contents of the AnyConnect
  • 34:38 - 34:43
    app package, which is basically a zip file
    containing all the executables and other
  • 34:43 - 34:50
    assets like images, etc.. The main
    executable is just called AnyConnect. The
  • 34:50 - 34:56
    network extension is implemented in the
    ACExtension binary. Beside these, there
  • 34:56 - 35:02
    are also several other app extension
    implementations for the iOS sharing and
  • 35:02 - 35:09
    Siri functionality. So what happens if you
    pressed the connect slider? After you hit
  • 35:09 - 35:13
    the slider, the network extension is
    started and negotiation of the VPN session
  • 35:13 - 35:19
    begins. After a section of network
    information like IP addresses, subnet
  • 35:19 - 35:23
    mask, routes, DNS, MTU and more they are
    passed to the iOS system to complete the
  • 35:23 - 35:29
    negotiation. In the end, you have a new
    and hopefully functional tunnel interface
  • 35:29 - 35:37
    called utun. So new traffic from apps pass
    through the network stack until it arrives
  • 35:37 - 35:42
    at the tunnel interface. It can then be
    handled by the network extensions' Packet
  • 35:42 - 35:48
    Tunnel Provider. Every time a packet
    arrives on a tunnel interface, it is read
  • 35:48 - 35:54
    by the network extension and encapsulated
    with the tunneling protocol. Every time a
  • 35:54 - 35:59
    packet arrives on the tunnel interface, it
    is read by the network extension and
  • 35:59 - 36:05
    encapsulated with the tunneling protocol.
    Upon arrival on the VPN server, the packet
  • 36:05 - 36:10
    is decapsulated and sent to its final
    destination. Similar the replies then
  • 36:10 - 36:15
    encapsulate sent to the client, which then
    decapsulates the packet and injects it
  • 36:15 - 36:20
    back to the network stack. So that's
    should be it for the iOS clients, just to
  • 36:20 - 36:24
    give you a quick overview and highlight
    some key differences between the
  • 36:24 - 36:31
    architectures. We are still investigating
    both Linux and iOS platforms, but until
  • 36:31 - 36:36
    now, we can summarize our findings as
    follows: AnyConnect in general is a huge
  • 36:36 - 36:43
    application with lots of code and also
    lots of unused library related code. We
  • 36:43 - 36:49
    discovered three vulnerabilities through
    design analysis. Vpnagentd runs with root
  • 36:49 - 36:54
    permissions and receives commands or
    operations from unprivileged processes via
  • 36:54 - 37:00
    unauthenticated IPC messages, which is
    generally a bit risky. Not all security
  • 37:00 - 37:04
    mechanisms and patches are actually
    included on all platforms. For example,
  • 37:04 - 37:09
    the downgrade was only possible on Linux
    and already patched on Windows and macOS
  • 37:09 - 37:14
    according to Cisco. The downgrade
    vulnerability is not possible on mobile,
  • 37:14 - 37:19
    as auto update feature is limited to
    Linux, Windows and macOS. Similar, the
  • 37:19 - 37:24
    Bring Your Own Script does also not apply
    in mobile, as deployment of OnConnect and
  • 37:24 - 37:29
    OnDisconnect script is also limited to
    Linux, Windows and macOS. Regarding the
  • 37:29 - 37:34
    local policy file on Linux, our idea would
    be to make it as restrictive as possible
  • 37:34 - 37:39
    and require some kind of opt-in for
    scripting functionality. As this would
  • 37:39 - 37:44
    prevent many attacks but of course, it
    would also impact the usability a bit.
  • 37:44 - 37:49
    Despite the app being available since many
    years, we show that there are still many
  • 37:49 - 37:54
    bugs to find. The introduction of bug
    bounties would be a great option to
  • 37:54 - 38:01
    motivate more security researchers to
    check the application for vulnerabilities.
  • 38:01 - 38:07
    The use of VPN promises security and
    privacy for users, however closed source
  • 38:07 - 38:11
    software opens new attack vectors on a
    system as our research on AnyConnect
  • 38:11 - 38:17
    shows. We hope that more research will be
    done on clients in the future and that our
  • 38:17 - 38:24
    work will pave the way for this. So that
    was it. Thank you very much for your
  • 38:24 - 38:30
    attention and if you have any questions,
    feel free to ask.
  • 38:31 - 38:36
    H: Well, welcome back. So that was the
    pre-recording of the super interesting
  • 38:36 - 38:41
    talk about Very Pwnable Networks. I'm sure
    you've seen how pwnable they really are
  • 38:41 - 38:49
    and luckily, we now have Jiska and Gerbert
    and Matthias with us today through the
  • 38:49 - 38:56
    magic of the Internet. And if you haven't
    written out your question yet, please do
  • 38:56 - 39:06
    so now so we can still answer them. Either
    by going to the IRC channel rc3-cwtv on
  • 39:06 - 39:12
    the hackened network or just posting a
    tweet or a toot with your favorite social
  • 39:12 - 39:19
    media network of choice containing the
    hashtag #rc3cwtv this time without any
  • 39:19 - 39:28
    dash, very important. So our Signal Angel
    has collected some questions for us that I
  • 39:28 - 39:33
    am now going to be torturing the three
    people here with. So let's see what you
  • 39:33 - 39:42
    will say to those. Oh, but I think pretty,
    pretty tame, huh? So first question: is
  • 39:42 - 39:46
    there any page or wiki where this
    information can be found?
  • 39:46 - 39:53
    G: At the moment, it is not published yet.
    I think we will publish - publish it in
  • 39:53 - 39:59
    near future on the GitHub or some similar
    platform.
  • 39:59 - 40:03
    H: Is there any way that people can find
    this link then when you eventually will
  • 40:03 - 40:08
    publish it in the future?
    G: I think Jiska can say something to this
  • 40:08 - 40:11
    J: Yeah so SEEMOO has a GitHub page and
  • 40:11 - 40:16
    also a Twitter account, so it will be
    published. But I mean, there's still a few
  • 40:16 - 40:22
    things that we didn't like - that are not
    public yet. So yeah, and then we would
  • 40:22 - 40:27
    just make one release not like this CVE
    and that CVE, but like all at once.
  • 40:27 - 40:32
    H: Yeah. Make - makes more of an impact
    this way and also better, better
  • 40:32 - 40:38
    disclosure. I like that. And the next
    question is: will this VPN event only be
  • 40:38 - 40:46
    about Cisco? So yes, you've only looked at
    Cisco, right? In this case. Um, maybe you
  • 40:46 - 40:51
    can tell us something if maybe you have
    looked at other VPN vendors as to
  • 40:51 - 40:56
    something that other VPN vendors might
    have an issue with as well? Maybe.
  • 40:56 - 41:02
    M: Yeah, we've done this research as part
    of a master's thesis, and therefore it's
  • 41:02 - 41:10
    only about Cisco AnyConnect and yeah, we
    did not have the time to - or yeah. Yeah.
  • 41:10 - 41:14
    To look at other VPN services, just for
    the AnyConnect.
  • 41:14 - 41:20
    H: Yeah, the typical Master's view writing
    it hyped up on coffee for the last few
  • 41:20 - 41:25
    weeks before the deadline. Yeah, I can
    imagine that you focused on Cisco there.
  • 41:25 - 41:31
    Uum, another very good question: Are these
    vulnerabilities also present in other - in
  • 41:31 - 41:35
    other AnyConnect-like clients like the
    ones integrated into NetworkManager in
  • 41:35 - 41:40
    Linux? I think they're talking especially
    about OpenConnect. Yeah, that's just
  • 41:40 - 41:46
    coming in. Umm, we talked about this
    before a little bit so you probably have
  • 41:46 - 41:50
    something to say about that.
    G: As far as we know there's - in
  • 41:50 - 41:57
    OpenConnect there is no scripting -
    scripting feature enabled or integrated.
  • 41:57 - 42:04
    So we would say this kind of attacks are
    not yet possible, but uh -
  • 42:04 - 42:11
    M: That would be possible if someone is
    able to check this and, yeah, have a look
  • 42:11 - 42:16
    into OpenConnect too, yeah.
    H: Hmm, yeah, not yet known to be
  • 42:16 - 42:24
    possible. Let's - let's say it like that.
    You never know. Any other questions from
  • 42:24 - 42:31
    chat, from Twitter or Mastodon? Now's the
    time. Give out your questions. Otherwise,
  • 42:31 - 42:40
    this would have been a very short Q&A. So
    if you go to the rc3-cwtv channel on the
  • 42:40 - 42:49
    hackened IRC network or post a tweet or a
    toot with the hashtag #rc3cwtv this time
  • 42:49 - 42:56
    without any dash. Umm, do it now, and
    hopefully I will still catch this
  • 42:56 - 43:01
    through the magic of the Signal Angel that
    is collecting all this information for me.
  • 43:01 - 43:06
    And yeah, maybe anything that you want to
    add or any other new topics that you're
  • 43:06 - 43:09
    working on, something that might be
    upcoming. Maybe we can get a sneak
  • 43:09 - 43:14
    preview. I'm sure you're still continuing
    the research there - and
  • 43:14 - 43:16
    J: Sorry I needed to unmute myself. Not
  • 43:16 - 43:20
    spoilering yet but I mean, the issue like
    just looking into one VPN client it's
  • 43:20 - 43:26
    also, if it is proprietary, then just
    reversing is a lot, a lot, a lot of work.
  • 43:26 - 43:33
    I mean, I can tell you a story about like,
    looking into binaries for months, and so
  • 43:33 - 43:38
    it doesn't really scale to look into like
    10 different clients, at least if you want
  • 43:38 - 43:44
    to have meaningful findings.
    H: Yeah, but like you don't have any any
  • 43:44 - 43:51
    other plans to, you know, look at any
    other clients that get any requests or any
  • 43:51 - 43:57
    triggers that would point you there. Maybe
    having a new phone and a new client and
  • 43:57 - 44:02
    noticing new strange things? No? - Okay.
    G: Not yet.
  • 44:02 - 44:06
    J: Yeah.
    G: But, but yes, Matthias is still working
  • 44:06 - 44:11
    on it. I think he will find something in
    the future. M: hopefully.
  • 44:11 - 44:21
    H: Yeah. Yeah. I guess that's pretty much
    all the last questions, except one: There
  • 44:21 - 44:26
    are two shadows behind you Jiska, is that
    the shadow cabinet?
  • 44:26 - 44:30
    J: No, no, no. I just have multiple lamps
    here. So -
  • 44:30 - 44:31
    H: Yeah, yeah, it's funny everyone <??>
  • 44:31 - 44:35
    J: At least it's only showing my shadow
    duplicate. Not - not me.
  • 44:35 - 44:40
    H: Yeah. But we're quite lucky that at
    least in this talk, the connection seems
  • 44:40 - 44:46
    to be working fine. We've been having some
    issues here. Yeah, but that's great. If
  • 44:46 - 44:51
    you have any other questions, I think
    we'll wrap it up here not to keep you
  • 44:51 - 44:57
    around much longer. I'm sure you're eager
    to jump around the rc3 world, and if you
  • 44:57 - 45:03
    have anything else, maybe you can join us
    in the IRC later. If there are any other
  • 45:03 - 45:09
    questions, maybe they will look there for
    a short while or I will forward those
  • 45:09 - 45:12
    questions. Right then.
    J: Thank you.
  • 45:12 - 45:17
    H: I thank you very much for the super
    interesting talk. I learned something new
  • 45:17 - 45:21
    about the VPN client that I came into
    contact with during my work time as well.
  • 45:21 - 45:28
    So interesting for me too. And yeah, let's
    keep it at that.
  • 45:28 - 45:36
    postroll music
  • 45:36 - 45:53
    Subtitles created by c3subtitles.de
    in the year 2022. Join, and help us!
  • 45:53 - 45:59
    [Translated by {Iikka}{Yli-Kuivila}
    (ITKST56 course assignment at JYU.FI)]
Title:
#rC3 Very Pwnable Network (VPN)
Description:

more » « less
Video Language:
English
Duration:
45:59

English subtitles

Revisions