ghidra | Ghidra is a software reverse engineering framework | Reverse Engineering library

 by   NationalSecurityAgency Java Version: Ghidra_10.3.1_build License: Apache-2.0

kandi X-RAY | ghidra Summary

kandi X-RAY | ghidra Summary

ghidra is a Java library typically used in Telecommunications, Media, Advertising, Marketing, Utilities, Reverse Engineering applications. ghidra has build file available, it has a Permissive License and it has high support. However ghidra has 5491 bugs and it has 9 vulnerabilities. You can install using 'pip install ghidra' or download it from GitHub, PyPI.

Ghidra is a software reverse engineering (SRE) framework created and maintained by the National Security Agency Research Directorate. This framework includes a suite of full-featured, high-end software analysis tools that enable users to analyze compiled code on a variety of platforms including Windows, macOS, and Linux. Capabilities include disassembly, assembly, decompilation, graphing, and scripting, along with hundreds of other features. Ghidra supports a wide variety of processor instruction sets and executable formats and can be run in both user-interactive and automated modes. Users may also develop their own Ghidra extension components and/or scripts using Java or Python. In support of NSA's Cybersecurity mission, Ghidra was built to solve scaling and teaming problems on complex SRE efforts, and to provide a customizable and extensible SRE research platform. NSA has applied Ghidra SRE capabilities to a variety of problems that involve analyzing malicious code and generating deep insights for SRE analysts who seek a better understanding of potential vulnerabilities in networks and systems. If you are a U.S. citizen interested in projects like this, to develop Ghidra and other cybersecurity tools for NSA to help protect our nation and its allies, consider applying for a career with us.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ghidra has a highly active ecosystem.
              It has 40166 star(s) with 4931 fork(s). There are 968 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 1193 open issues and 2697 have been closed. On average issues are closed in 145 days. There are 166 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of ghidra is Ghidra_10.3.1_build

            kandi-Quality Quality

              OutlinedDot
              ghidra has 5491 bugs (85 blocker, 28 critical, 1830 major, 3548 minor) and 61806 code smells.

            kandi-Security Security

              OutlinedDot
              ghidra has 6 vulnerability issues reported (3 critical, 3 high, 0 medium, 0 low).
              ghidra code analysis shows 3 unresolved vulnerabilities (0 blocker, 3 critical, 0 major, 0 minor).
              There are 379 security hotspots that need review.

            kandi-License License

              ghidra is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              ghidra releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed ghidra and discovered the below as its top functions. This is intended to give you an instant insight into ghidra implemented functionality, and help decide if they suit your requirements.
            • Gets the primitive ms type .
            • ProcessType Method .
            • Returns the next pcode for the given instruction .
            • Perform the given relocation .
            • Returns an AppSymbolApplier for the given iterator
            • Parses a record .
            • Create the filters .
            • Simplify a Vcode operation .
            • Gets type applier .
            • Processes a data type and converts it to a data type .
            Get all kandi verified functions for this library.

            ghidra Key Features

            No Key Features are available at this moment for ghidra.

            ghidra Examples and Code Snippets

            No Code Snippets are available at this moment for ghidra.

            Community Discussions

            QUESTION

            Ghidra headless analyzer
            Asked 2022-Mar-23 at 09:37

            I am trying to decompile nodejs bytecode using ghidra, and there is this specific plugin which decompiles the the nodejs bytecode. How can I install that plugin using ghidra headless method?

            And another question I have is, after analysing the nodejs bytecode it generated a .rep folder, which I am not sure what to do about now, as I thought it will be giving me the source code after analysis.

            Thanks in advance :)

            ...

            ANSWER

            Answered 2022-Mar-23 at 09:37

            Installing a plugin in Ghidra via GUI is just an unzip with extra checks. Headless install is described in the doc at https://ghidra-sre.org/InstallationGuide.html#GhidraExtensionNotes

            To install an extension in these cases, simply extract the desired Ghidra extension archive file(s) to the /Ghidra/Extensions directory. For example, on Linux or macOS:

            1. Set current directory to the Ghidra installed-extensions directory: cd /Ghidra/Extensions
            2. Extract desired extension archive file(s) to the current directory: unzip /path/to/.zip
            3. The extension(s) will be installed the next time Ghidra is started.

            How to dump the source code will depend on the plugin you are using, without a link it's hard to tell. I guess it just allows disassembling NodeJS bytecode, so you have to use the regular Ghidra APIs or scripts to dump disassembly?

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

            QUESTION

            Ghidra decompile windows is greyed backgound
            Asked 2022-Feb-13 at 17:33

            For some methods, Ghidra's decompiler background window is greyed out and I can't rename the function nor the local variables. Why?

            It works fine for methods with a "white background".

            Example:

            Matching code

            ...

            ANSWER

            Answered 2022-Feb-13 at 17:33

            You can only do rename in a fully defined function. The grey background means that Ghidra didn't properly create a function at this point. You can see this also in a disassembly where you only have a label at this location. If you think this is a function you can type F and define a function. It should enable all the edit options.

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

            QUESTION

            Is there a command execution vulnerability in this C program?
            Asked 2022-Feb-02 at 10:16

            So I am working on a challenge problem to find a vulnerability in a C program binary that allows a command to be executed by the program (using the effective UID in Linux).

            I am really struggling to find how to do this with this particular program.

            The disassembly of the function in question (main function):

            ...

            ANSWER

            Answered 2022-Feb-02 at 10:16

            In regular C code, execlp("tidy","tidy","-asxml",0); is incorrect as execlp() expects a null pointer argument to mark the end of the argument list.

            0 is a null pointer when used in a pointer context, which this is not. Yet on architectures where pointers have the same size and passing convention as int, such as 32-bit linux, passing 0 or passing NULL generate the same code, so sloppiness does not get punished.

            In 64-bit mode, it would be incorrect to do so but you might get lucky with the x86_64 ABI and a 64-bit 0 value will be passed in this case.

            In your own code, avoid such pitfalls and use NULL or (char *)0 as the last argument for execlp(). But on this listing, Ghidra produces code that generates the same assembly code, and in 32-bit mode, passing 0 or (char *)0 produce the same code, so no problem here.

            In your context, execlp("tidy","tidy","-asxml",0); shows another problem: it will look for an executable program with the name tidy in the current PATH and run this program as tidy with a command line argument -asxml. Since it changed the effective uid and gid, this is a problem if the program is setuid root because you can create a program named tidy in a directory appearing in the PATH variable before the system directories and this program will be run with the modified rights.

            Another potential problem is the program does not check for failure of the system calls setreuid() and setregid(). Although these calls are unlikely to fail for the arguments passed, as documented in the manual pages, it is a grave security error to omit checking for a failure return from setreuid(). In case of failure, the real and effective uid (or gid) is not changed and the process may fork and exec with root privileges.

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

            QUESTION

            How can I determine this string value based on the C disassembly?
            Asked 2022-Jan-24 at 01:47

            So I am working on a "find the password" type binary disassembly problem and cannot quite figure it out.

            The assembly is as follows:

            function checkpw

            ...

            ANSWER

            Answered 2022-Jan-24 at 01:44

            QUESTION

            how to make Ghidra use a function's complete/original stackframe for decompiled code
            Asked 2022-Jan-14 at 17:33

            I have a case where some function allocates/uses a 404 bytes temporary structure on the stack for its internal calculations (the function is self-contained and shuffles data around within that data structure). Conceptually the respective structure seems to consist of some 32-bit counters followed by an int[15] and a byte[80] array, and then an area that might or might not actually be used. Some of the generated data in the tables seems to represent offsets that are again used by the function to navigate within the temporary structure.

            Unfortunately Ghidra's decompiler makes a total mess while trying to make sense of the function: In particular it creates separate "local_.." int-vars (and then uses a pointer to that var) for what should correctly be a pointer into the function's original data-structure (e.g. pointing into one of the arrays).

            ...

            ANSWER

            Answered 2022-Jan-14 at 17:33

            I think I found something.. In the "Listing" view the used local-variable layout is shown as a comment under the function's header. It seems that by right clicking on a respective local-var line in that comment, "set data type" can be applied to a respective local variable. Ah, and then there is what I've been looking for under "Function/"Edit stack frame" :-)

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

            QUESTION

            what's this decompiled f2xm1/fscale sequence meant to do?
            Asked 2022-Jan-10 at 08:37

            I am trying to reverse engineer some decomiled code which originally had been written in C/C++, i.e. I suspect that the below FPU related code sequence is probably derived from some simple C-code "double" handling that justs looks more complicated in the generated assembly code. Leading up to this point, some floating point multiplications had been performed with the result in ST0 (corresponding to d1). I've read the docs on what the underlying FPU operations technically do, still the intention of the respective code sequence still isn't obvious to me.

            ...

            ANSWER

            Answered 2022-Jan-10 at 08:37

            Seems it is some variation of a pow(x,y) implementation (see How can I write a power function myself? ). Ghidra just made a total mess of it in the decompiled code view.

            Tracing the results in the debugger the performed functionality is indeed:

            pow((float10)DOUBLE_00430088, (float10)param_1[0x58])

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

            QUESTION

            Decompiler not working in Ghidra Disassembler
            Asked 2022-Jan-09 at 14:46

            I'm kind of new to Ghidra Disassembler so kindly bear with me .

            I was trying to install Ghidra to analyse an executable. After opening the executable in Ghidra it loads everything fine except Decompiler. Decompiler window displays

            Decompiler: Unable to initialize the DecompilerInterface: Could not find decompiler executable" this error message. Also it shows "os/mac_x86_64/decompile does not exist

            I downloaded it from here. I also have JDK installed in my mac. What should i do so as to make Decompiler work?

            As the error says there is no decompiler inside "os/mac_x86_64". Not sure on what i should do.

            ...

            ANSWER

            Answered 2022-Jan-09 at 14:46

            Issue happened because I removed the decompile file while installing ghidra for the first coz gatekeeper in my Mac prompted me to remove it as it was from github. Solution to this issue is to allow it in the Security & Privacy . Thank you @Robert for ur inputs and ur time. U saved me ton of time.

            Clicking "Allow Anyways" without removing decompile fixed the issue for me.

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

            QUESTION

            How to reverse strings that have been obfuscated using floats and double?
            Asked 2021-Dec-24 at 01:09

            I'm working on a crackme , and having a bit of trouble making sense of the flag I'm supposed to retrieve. I have disassembled the binary using radare2 and ghidra , ghidra gives me back the following pseudo-code:

            ...

            ANSWER

            Answered 2021-Dec-24 at 01:09

            You can tweak the Ghidra reverse result by edit variable type. Based on scanf const string %32s your local_38 should be char [32].

            Before the first if, there are some char swap.

            And the first if statment give you a long constrain of flag

            At this point, you can confirm part of flag is FARADAY{d0ubl3_@nd_f1o@t, then is ther main part of this challenge.

            It print x, y, z based on the flag, but you'll quickly find x and y is constrain by the if, so you only need to solve z to get the flag, so you think you need to bruteforce all double value limit by printable ascii.

            But there are a limitaion in if statment says byte0 of this double must be _ and a math constrain there, simple math tell dVar2 - 4088116.817143337 <= 1.192092895507813e-07 and it comes dVar2 is very close 4088116.817143337 And byte 3 and byte 7 in this double will swap

            By reverse result: dVar2 = y*y*x*x/z, solve this equation you can say z must near 407.2786840401004 and packed to little endian is `be}uty@. Based on double internal structure format, MSB will affect exponent, so you can make sure last byte is @ and it shows byte0 and byte3 is fixed now by constrain and flag common format with {} pair.

            So finally, you only need to bureforce 5 bytes of printable ascii to resolve this challenge.

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

            QUESTION

            Question marks in ghidra DAT_*
            Asked 2021-Nov-09 at 09:15

            I disassembled a jni .so file(the native part of an android application) and I decompiled one of its function in ghidra.

            I saw a DAT_* in a part of decompiled code and when I double clicked on that ghidra show me only question marks.

            What should I do for finding the data in the DAT_*

            ( '*' Means any chars )

            ...

            ANSWER

            Answered 2021-Nov-09 at 09:15

            I think what you are referring to are the questions mark like in this screenshot:

            This just means that the datatype of the data at this address is not yet defined in any way. For example, if you specify the data at this address to be of the type QWORD it will state dq and look like this:

            if it is a string it will contain ds and look like this

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

            QUESTION

            Can Ghidra re-compile and run a short function?
            Asked 2021-Oct-23 at 09:19

            I've picked out a short and "self-contained" function from the Ghidra decompiler. Can Ghidra itself compile the function again so I can try to run it for a couple different values, or would I need to compile it myself with e.g. gcc?

            Attaching the function for context:

            ...

            ANSWER

            Answered 2021-Oct-22 at 03:08

            You can, but you'll have to change some of the types to be standard C, or just add typedefs like so:

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install ghidra

            To install an official pre-built multi-platform Ghidra release:. For additional information and troubleshooting tips about installing and running a Ghidra release, please refer to docs/InstallationGuide.html which can be found in your extracted Ghidra release directory.
            Install JDK 11 64-bit
            Download a Ghidra release file
            Extract the Ghidra release file
            Launch Ghidra: ./ghidraRun (or ghidraRun.bat for Windows)
            To create the latest development build for your platform from this source repository:. NOTE: Instead of downloading the compressed source, you may instead want to clone the GitHub repository: git clone https://github.com/NationalSecurityAgency/ghidra.git. The compressed development build will be located at build/dist/. For more detailed information on building Ghidra, please read the Developer Guide.
            JDK 11 64-bit
            Gradle 6.8+ or 7.x
            make, gcc, and g++ (Linux/macOS-only)
            Microsoft Visual Studio (Windows-only)

            Support

            If you would like to contribute bug fixes, improvements, and new features back to Ghidra, please take a look at our Contributor Guide to see how you can participate in this open source project.
            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/NationalSecurityAgency/ghidra.git

          • CLI

            gh repo clone NationalSecurityAgency/ghidra

          • sshUrl

            git@github.com:NationalSecurityAgency/ghidra.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

            Consider Popular Reverse Engineering Libraries

            ghidra

            by NationalSecurityAgency

            radare2

            by radareorg

            ILSpy

            by icsharpcode

            bytecode-viewer

            by Konloch

            ImHex

            by WerWolv

            Try Top Libraries by NationalSecurityAgency

            SIMP

            by NationalSecurityAgencyRuby

            lemongraph

            by NationalSecurityAgencyPython

            datawave

            by NationalSecurityAgencyJava

            timely

            by NationalSecurityAgencyCSS

            DCP

            by NationalSecurityAgencyC