CVE-2018-8897 | Arbitrary code execution with kernel privileges using CVE | Hacking library

 by   can1357 C++ Version: Current License: BSD-3-Clause

kandi X-RAY | CVE-2018-8897 Summary

kandi X-RAY | CVE-2018-8897 Summary

CVE-2018-8897 is a C++ library typically used in Security, Hacking applications. CVE-2018-8897 has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Arbitrary code execution with kernel privileges using CVE-2018-8897.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              CVE-2018-8897 has a low active ecosystem.
              It has 391 star(s) with 110 fork(s). There are 16 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 6 have been closed. On average issues are closed in 0 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of CVE-2018-8897 is current.

            kandi-Quality Quality

              CVE-2018-8897 has 0 bugs and 0 code smells.

            kandi-Security Security

              CVE-2018-8897 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              CVE-2018-8897 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              CVE-2018-8897 is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              CVE-2018-8897 releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CVE-2018-8897
            Get all kandi verified functions for this library.

            CVE-2018-8897 Key Features

            No Key Features are available at this moment for CVE-2018-8897.

            CVE-2018-8897 Examples and Code Snippets

            No Code Snippets are available at this moment for CVE-2018-8897.

            Community Discussions

            QUESTION

            Explain Linux commit message that patches/secures POP SS followed by a #BP interrupt (INT3)
            Asked 2018-May-11 at 15:50

            This is in reference to CVE-2018-8897 (which appears related to CVE-2018-1087), described as follows:

            A statement in the System Programming Guide of the Intel 64 and IA-32 Architectures Software Developer's Manual (SDM) was mishandled in the development of some or all operating-system kernels, resulting in unexpected behavior for #DB exceptions that are deferred by MOV SS or POP SS, as demonstrated by (for example) privilege escalation in Windows, macOS, some Xen configurations, or FreeBSD, or a Linux kernel crash. The MOV to SS and POP SS instructions inhibit interrupts (including NMIs), data breakpoints, and single step trap exceptions until the instruction boundary following the next instruction (SDM Vol. 3A; section 6.8.3). (The inhibited data breakpoints are those on memory accessed by the MOV to SS or POP to SS instruction itself.) Note that debug exceptions are not inhibited by the interrupt enable (EFLAGS.IF) system flag (SDM Vol. 3A; section 2.3). If the instruction following the MOV to SS or POP to SS instruction is an instruction like SYSCALL, SYSENTER, INT 3, etc. that transfers control to the operating system at CPL < 3, the debug exception is delivered after the transfer to CPL < 3 is complete. OS kernels may not expect this order of events and may therefore experience unexpected behavior when it occurs.

            When reading this related git commit to the Linux kernel, I noted that the commit message states:

            x86/entry/64: Don't use IST entry for #BP stack

            There's nothing IST-worthy about #BP/int3. We don't allow kprobes in the small handful of places in the kernel that run at CPL0 with an invalid stack, and 32-bit kernels have used normal interrupt gates for #BP forever.

            Furthermore, we don't allow kprobes in places that have usergs while in kernel mode, so "paranoid" is also unnecessary.

            In light of the vulnerability, I'm trying to understand the last sentence/paragraph in the commit message. I understand that an IST entry refers to one of the (allegedly) "known good" stack pointers in the Interrupt Stack Table that can be used to handle interrupts. I also understand that #BP refers to a breakpoint exception (equivalent to INT3), and that kprobes is the debugging mechanism that is claimed to only run in a few places in the kernel at ring 0 (CPL0) privilege level.

            But I'm completely lost in the next part, which may be because "usergs" is a typo and I'm simply missing what was intended:

            Furthermore, we don't allow kprobes in places that have usergs while in kernel mode, so "paranoid" is also unnecessary.

            What does this statement mean?

            ...

            ANSWER

            Answered 2018-May-11 at 15:50

            usergs is referring to the x86-64 swapgs instruction, which exchanges gs with an internal saved GS value for the kernel to find the kernel stack from a syscall entry point. The swaps also swap the cached gsbase segment info, rather than reloading from the GDT based on the gs value itself. (wrgsbase can change the GS base independently of the GDT/LDT)

            AMD's design is that syscall doesn't change RSP to point to the kernel stack, and doesn't read/write any memory, so syscall itself can be fast. But then you enter the kernel with all registers holding their user-space values. See Why does Windows64 use a different calling convention from all other OSes on x86-64? for some links to mailing list discussions between kernel devs and AMD architects in ~2000, tweaking the design of syscall and swapgs to make it usable before any AMD64 CPUs were sold.

            Apparently keeping track of whether GS is currently the kernel or user value is tricky for error handling: There's no way to say "I want kernelgs now"; you have to know whether to run swapgs or not in any error-handling path. The only instruction is a swap, not a set it to one vs. the other.

            Read comments in arch/x86/entry/entry_64.S e.g. https://github.com/torvalds/linux/blob/9fb71c2f230df44bdd237e9a4457849a3909017d/arch/x86/entry/entry_64.S#L1267 (from current Linux) which mentions usergs, and the next block of comments describes doing a swapgs before jumping to some error handling code with kernel gsbase.

            IIRC, the Linux kernel [gs:0] holds a thread info block, at the lowest addresses of the kernel stack for that thread. The block includes the kernel stack pointer (as an absolute address, not relative to gs).

            I wouldn't be surprised if this bug is basically tricking the kernel to loading kernel rsp from a user-controlled gsbase, or otherwise screwing up the dead-reckoning of swapgs so it has the wrong gs at some point.

            Source https://stackoverflow.com/questions/50286277

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install CVE-2018-8897

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/can1357/CVE-2018-8897.git

          • CLI

            gh repo clone can1357/CVE-2018-8897

          • sshUrl

            git@github.com:can1357/CVE-2018-8897.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Hacking Libraries

            wifiphisher

            by wifiphisher

            routersploit

            by threat9

            XSStrike

            by s0md3v

            pwntools

            by Gallopsled

            Atmosphere

            by Atmosphere-NX

            Try Top Libraries by can1357

            NoVmp

            by can1357C++

            ByePg

            by can1357C++

            NtRays

            by can1357C++

            NtLua

            by can1357C