stadeo | Control-flow-flattening and string deobfuscator | Reverse Engineering library

 by   eset Python Version: Current License: Non-SPDX

kandi X-RAY | stadeo Summary

kandi X-RAY | stadeo Summary

stadeo is a Python library typically used in Telecommunications, Media, Advertising, Marketing, Utilities, Reverse Engineering applications. stadeo has no bugs, it has no vulnerabilities, it has build file available and it has low support. However stadeo has a Non-SPDX License. You can download it from GitHub.

Stadeo is a set of tools primarily developed to facilitate analysis of [Stantinko] which is a botnet performing click fraud, ad injection, social network fraud, password stealing attacks and [cryptomining] The scripts, written entirely in Python, deal with Stantinko’s unique control-flow-flattening (CFF) and string obfuscation techniques described in our March 2020 [blogpost] Additionally, they can be utilized for other purposes: for example, we’ve already extended our approach to support deobfuscating the CFF featured in Emotet – a trojan that steals banking credentials and that downloads additional payloads such as ransomware. Our deobfuscation methods use [IDA] which is a standard tool in the industry, and [Miasm] – an open source framework providing us with various data-flow analyses, a symbolic execution engine, a dynamic symbolic execution engine and the means to reassemble modified functions.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              stadeo has a low active ecosystem.
              It has 115 star(s) with 12 fork(s). There are 5 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 2 have been closed. On average issues are closed in 23 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of stadeo is current.

            kandi-Quality Quality

              stadeo has no bugs reported.

            kandi-Security Security

              stadeo has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              stadeo has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              stadeo releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed stadeo and discovered the below as its top functions. This is intended to give you an instant insight into stadeo implemented functionality, and help decide if they suit your requirements.
            • Processing function calls
            • Get the dependencies
            • Split the function into memory
            • Return a new state with the given loc_key
            • Normalize self ircfg
            • Resize a top expression
            • Track assignments
            • Check if a push parameter is a push parameter
            • Patch xrefs to xrefs
            • Compare two arguments
            • Replace instruction with the same size
            • Get a list of DependencyResult
            • Process all the input addresses
            • Process the given functions
            • Process a function
            • Emulate the multiplication
            • Wipe dse errors
            • Process all functions
            • Process extended discovery
            • Process a CMOV instruction
            • Create a conditional branch instruction
            • Create a new MOV instruction
            Get all kandi verified functions for this library.

            stadeo Key Features

            No Key Features are available at this moment for stadeo.

            stadeo Examples and Code Snippets

            No Code Snippets are available at this moment for stadeo.

            Community Discussions

            QUESTION

            MySQL first database creation
            Asked 2022-Mar-26 at 19:18

            I need to create a database for employees that stores information about their names, salaries, salary status, dates, and messages between the employees. At least 3 users are needed. Foreign keys and an ER diagram. Can I go about creating this database by creating tables, importing data thru code and then just create a diagram by reverse engineering. I have no clue. My main concern is whether it is enough to only use tables or is there more to it? I'm completely new to MySQL and I hope some of you can help me out.

            ...

            ANSWER

            Answered 2022-Mar-26 at 19:18

            If you are using phpmyadmin, you can easily create a database and tables. or if you want to create by code you can use like,

            CREATE DATABASE databasename;

            and table will be created by like,

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

            QUESTION

            Php array to pow numbers revers function problem
            Asked 2022-Mar-18 at 14:41
            
            -1;$i--){
                    $pow = pow(2, $i);
                    if($pow < $flag){
                        $str = ",".$target[$pow].$str;
                        $flag = $flag-$pow;
                    }elseif($pow == $flag){
                        return "".$target[$pow].$str;
                    }
                }
                return "NONE";
            }
            
            
            $sample=["AGGR","AGGR,BERSERK","AGGR,BERSERK,DEATHBLOW,REVIVE","AGGR,BERSERK,STONESKIN","AGGR,BERSERK,STONESKIN,DEATHBLOW","AGGR,BERSERK,STONESKIN,DEATHBLOW,REVIVE","AGGR,BERSERK,STONESKIN,DEATHBLOW,REVIVE","AGGR,DEATHBLOW","AGGR,GODSPEED","AGGR,GODSPEED","AGGR,NOATTCHUNJO","AGGR,NOATTJINNO","AGGR,NOATTSHINSU","AGGR,NOMOVE","AGGR,REVIVE","AGGR,STONESKIN","BERSERK","BERSERK,STONESKIN","COWARD","NOMOVE","AGGR,NOMOVE,BERSERK,GODSPEED,DEATHBLOW","NOMOVE,STONESKIN","NOMOVE,STONESKIN","REVIVE"];
            foreach($sample as $k=>$v){
                $no1=array2aiflag($v);
                $no2=array2aiflag(aiflag2array($no1));
                if($v != aiflag2array($no1)){
                    echo ' OriginalData - '.$v.' ['.$no1.'] - ReversData - '.aiflag2array($no1).' ['.$no2.']
            '; }else{ echo '
            OriginalData - '.$v.' ['.$no1.'] - ReversData - '.aiflag2array($no1).' ['.$no2.']
            '; } } ?>
            ...

            ANSWER

            Answered 2022-Mar-18 at 14:41

            OK, I thought this was a nice thing to work on. I must say that I miss the context, I have no idea what this will be used for. Context is important for understanding the code. I assume it is some kind of game?

            The first thing to do is to get the array definitions out of the way:

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

            QUESTION

            Translating C# to PowerShell
            Asked 2022-Mar-17 at 17:30

            I am trying to translate this code from C# to PowerShell

            ...

            ANSWER

            Answered 2022-Mar-17 at 17:30

            See also: This follow-up question.

            That your cast's operand is a COM object (as evidenced by System.__ComObject being reported as the object type in the error message) may be the source of the problem, because I don't think PowerShell can cast COM objects to other types.

            However, given that PowerShell can dynamically discover members on objects, in many cases where C# requires casts, PowerShell doesn't (and casts to interfaces are no-ops in PowerShell, except when guiding method overload resolution). Similarly, there's no (strict) need to type variables.[1]

            Thus, as you've confirmed, simply omitting the cast of $thMainPipe.InnerObject to type [Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe] worked:

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

            QUESTION

            How to obfuscate Kotlin properties with R8?
            Asked 2022-Mar-07 at 08:58

            I have a library on Kotlin I want to obfuscate almost completely but leave the public classes, properties and methods untouched. Here is an example of one of the public classes I intend to obfuscate:

            ...

            ANSWER

            Answered 2022-Mar-07 at 08:58

            So the answer to this question was more or less explained in this article. Basically the issue was that the code was indeed obfuscated properly but there was still Kotlin Metadata and Android Studio was reconstructing the code based on this Metadata.

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

            QUESTION

            How to download a file using Python requests, when that file is being served with redirect?
            Asked 2022-Feb-22 at 01:50

            I'm trying to download a book from Fadedpage, like this one. If you click on the link to the HTML file there, it will display the HTML file. The URL appears to be https://www.fadedpage.com/books/20170817/html.php. But if you try to download that URL by any of the usual means, you only get the metadata HTML, not the HTML with the full text of the book. For instance, running wget https://www.fadedpage.com/books/20170817/html.php from the command line does return HTML, but it's again the metadata HTML file from https://www.fadedpage.com/showbook.php?pid=20170817, not the full text of the book.

            Here's what I've tried so far:

            ...

            ANSWER

            Answered 2022-Feb-22 at 01:50
            1. Pass cookies={"PHPSESSID": "3r7ql7poiparp92ia7ltv8nai5"} instead of headers={"cookie": "PHPSESSID=3r7ql7poiparp92ia7ltv8nai5"}.
              This is because the requests library does headers.pop('Cookie', None) upon redirect.
            2. Retry if resp.url is not f"https://www.fadedpage.com/books/{bookID}/{fileType}.php".
              This is because the server first redirects link.php with a different bookID to showbook.php.
            3. A download of downloadFile("20170817", "html") contains the text "The First Part of this book is intended for pupils", not "woodland slope behind St. Pierre-les-Bains" that is contained in a download of downloadFile("20130603", "html").

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

            QUESTION

            Time-dependent, repeatable pseudo-random number
            Asked 2022-Feb-11 at 16:06

            I need to generate a repeatable pseudo-random number that is dependent on the current time and a server secret. For example, this mechanism should generate a new pseudo-random number every minute. The next minute's random number should not be easily predictable.

            Furthermore, I need to solve this in a stateless fashion (e.g., without storing a generated value in a database). It is possible that a server node might be asked to create such a number multiple times within the same minute, and it needs to generate the same number each time. Also, multiple server nodes (with the same server secret) need to generate the same number within a given time frame. The purpose of all this is not related to solving a security problem (e.g. a token generator), so it's not strictly necessary to use cryptographically secure PRNGs.

            Linear-congruential PRNGs produce repeatable series of numbers when initialized with the same seed, so I could seed the PRNG with the combination of time and server secret and get the first random number it produces to meet my criteria. However, this type of PRNG typically uses a simple formula of next = (current * multiplier + offset) & mask, and, given a few known times and corresponding random numbers, it seems like it would be not all that hard to figure out the server secret (and then predict all future numbers in advance).

            To make this sort of reverse engineering harder, I pull and discard a fixed number (e.g., 1000) of values from the freshly seeded PRNG before I get the "real" random number that I use. My thinking is that reverse-engineering 1000 cycles of next = (current * multiplier + offset) & mask would be significantly more difficult that reverse-engineering just a single cycle.

            I am wondering if my thinking here is even correct. Is it true that figuring out a linear-congruential PRNG's seed is more difficult based on the 1000th value after seeding than it is for the first value of a freshly seeded generator? If so, how many iterations are sufficient before it stops increasing the difficulty?

            If I'm completely off here, what are some better alternatives that fulfill the above stated criteria (repeatability, statelessness)?

            ...

            ANSWER

            Answered 2022-Feb-11 at 16:06

            In a way, this is how Time-based one-time passwords (TOTPs) work, so you can use a similar solution.

            To get a time value that changes every N seconds, you can use the following formula.

            floor(timestamp / N)

            Then, you can either turn that into a string or interpret it as bytes. Just pass it to something like HMAC in order to turn it into a pseudo-random value.

            HMAC(SecretKey, floor(timestamp / N))

            Here's a simple implementation in Python. This should be fairly similar in other languages too.

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

            QUESTION

            Selecting random radio button using JavaScript
            Asked 2022-Jan-25 at 19:59

            Objective

            I'm using Alchemer (formerly SurveyGizmo) to create a survey. To properly route my participants I need to create a hidden question with radio buttons (single choice) in combination with a JavaScript action that selects one of the radio buttons randomly. The JavaScript should execute automatically when the page was loaded.

            What I did

            I searched stackoverflow and the internet, found a couple JSFiddles that did similar things, tried reverse engineering a solution for me, but it wont work.

            I have zero education regarding programming languages, just going with the little that I think I understand from looking at other peoples work.

            Using "Inspect Element", I see that my radio buttons all have the class 'sg-input sg-input-radio", so I try collecting them using getElementsByClassName, not even sure if this is the way to approach this.

            Here is what I got so far

            ...

            ANSWER

            Answered 2022-Jan-25 at 19:57

            I think the getElementsByClassName may have problems with multiple classes. So I used querySelectorAll and it works.

            Maybe it was a c+p error, but in your example code a ); was missing.

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

            QUESTION

            How to securely store a hardcoded API key on Android?
            Asked 2022-Jan-03 at 11:06

            In my Android project, I want to store an API key in a secured manner. That key is generated from outside the app and need to be stored somehow in the app before building the app.

            I've seen some examples of how to use the KeyStore (like this or this), but as far as I understand, those are solutions to store secret keys generated during runtime, and not keys that I would store somewhere in my code.

            I've also checked the other methods explained here, but they look like the API key could quite easily be retrieved thanks to reverse engineering.

            I also don't want to store my key in my code, also because it could easily be retrieved via reverse engineering.

            The purpose of it is to be able to send that key everytime I call a webservice that I've made, so I'm sure (or almost sure) that the call comes from the original app that I'm making and that will be published on the Play Store, and not from elsewhere.

            I'm far from being a security expert, so any help would be appreciated.

            Thanks.

            ...

            ANSWER

            Answered 2022-Jan-03 at 11:06
            YOUR CHALLENGE

            The purpose of it is to be able to send that key everytime I call a webservice that I've made, so I'm sure (or almost sure) that the call comes from the original app that I'm making and that will be published on the Play Store, and not from elsewhere.

            This is a very hard task to achieve, but not impossible one and here is where one needs to make a deep dive in mobile API security and understand the mechanics behind it.

            It's fundamental to have a clear understand between the difference of who is in the API request versus what is making that API request, otherwise any security solution you may devise/use may not have the intended results.

            The Difference Between WHO and WHAT is Accessing the API Server

            I wrote a series of articles around API and Mobile security, and in the article Why Does Your Mobile App Need An Api Key? you can read in detail the difference between who and what is accessing your API server, but I will extract here the main takes from it:

            The what is the thing making the request to the API server. Is it really a genuine instance of your mobile app, or is it a bot, an automated script or an attacker manually poking around your API server with a tool like Postman?

            The who is the user of the mobile app that we can authenticate, authorize and identify in several ways, like using OpenID Connect or OAUTH2 flows.

            So, you need to think about the who as the user your API server will be able to Authenticate and Authorize access to the data, and you need to think about the what as the software making that request in behalf of the user.

            REVERSE ENGINEERING

            I also don't want to store my key in my code, also because it could easily be retrieved via reverse engineering.

            That's very true, it's more or less easily achieved depending on the method used to hide the API key, as per the ones you mention:

            I've also checked the other methods explained here, but they look like the API key could quite easily be retrieved thanks to reverse engineering.

            No matter how secure the API key has been stored, be it in the Android Keystore, encrypted, obfuscated, etc, at some point the API key will need to be in plain text to be sent on the API request header, and in this moment it will be vulnerable to be extracted via static reverse engineering, via a MitM attack or via an instrumentation framework

            I have wrote the article How to Extract an API key from a Mobile App with Static Binary Analysis to illustrate how easy it can be done:

            The range of open source tools available for reverse engineering is huge, and we really can't scratch the surface of this topic in this article, but instead we will focus in using the Mobile Security Framework(MobSF) to demonstrate how to reverse engineer the APK of our mobile app. MobSF is a collection of open source tools that present their results in an attractive dashboard, but the same tools used under the hood within MobSF and elsewhere can be used individually to achieve the same results.

            During this article we will use the Android Hide Secrets research repository that is a dummy mobile app with API keys hidden using several different techniques.

            I also wrote another article to achieve it during runtime, Steal that Api Key with a Man in the Middle Attack:

            In order to help to demonstrate how to steal an API key, I have built and released in Github the Currency Converter Demo app for Android, which uses the same JNI/NDK technique we used in the earlier Android Hide Secrets app to hide the API key.

            So, in this article you will learn how to setup and run a MitM attack to intercept https traffic in a mobile device under your control, so that you can steal the API key. Finally, you will see at a high level how MitM attacks can be mitigated.

            An instrumentation framework can also be used during runtime to hook into the code that uses the API key in order to extract it. For example with the popular Frida framework:

            Inject your own scripts into black box processes. Hook any function, spy on crypto APIs or trace private application code, no source code needed. Edit, hit save, and instantly see the results. All without compilation steps or program restarts.

            So, no matter what it's done to secure the API key, once it's on the API request will be vulnerable to be extracted.

            MOBILE API SECURITY

            Anything that runs on the client side and needs some secret to access an API can be abused in different ways and you can learn more on this series of articles about Mobile API Security Techniques. This articles will teach you how API Keys, User Access Tokens, HMAC and TLS Pinning can be used to protect the API and how they can be bypassed.

            POSSIBLE SOLUTIONS

            I recommend you to read this answer I gave to the question How to secure an API REST for mobile app?, especially the sections Hardening and Shielding the Mobile App, Securing the API Server and A Possible Better Solution.

            The possible best solution for your problem is known by Mobile App Attestation, that will let your backend know that what is making the request is indeed a genuine and untampered version of your mobile app, as you wish to achieve:

            The purpose of it is to be able to send that key everytime I call a webservice that I've made, so I'm sure (or almost sure) that the call comes from the original app that I'm making and that will be published on the Play Store, and not from elsewhere.

            Do You Want To Go The Extra Mile?

            In any response to a security question I always like to reference the excellent work from the OWASP foundation.

            For APIS

            OWASP API Security Top 10

            The OWASP API Security Project seeks to provide value to software developers and security assessors by underscoring the potential risks in insecure APIs, and illustrating how these risks may be mitigated. In order to facilitate this goal, the OWASP API Security Project will create and maintain a Top 10 API Security Risks document, as well as a documentation portal for best practices when creating or assessing APIs.

            For Mobile Apps

            OWASP Mobile Security Project - Top 10 risks

            The OWASP Mobile Security Project is a centralized resource intended to give developers and security teams the resources they need to build and maintain secure mobile applications. Through the project, our goal is to classify mobile security risks and provide developmental controls to reduce their impact or likelihood of exploitation.

            OWASP - Mobile Security Testing Guide:

            The Mobile Security Testing Guide (MSTG) is a comprehensive manual for mobile app security development, testing and reverse engineering.

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

            QUESTION

            Reverse engineering .proto files from pb2.py generated with protoc
            Asked 2021-Dec-26 at 13:00

            Is it possible to get proto files from generated pb2.py with protoc? Will be the same reverse engineering possible for gRPC?

            ...

            ANSWER

            Answered 2021-Dec-25 at 16:37

            It is possible but I'm unaware of any tools that do this.

            Protocol Buffers (protos) including gRPC service definitions are compiled by protoc into language-specific sources. You're looking for a decompiler.

            We know that the process is invertible because it works; we're able to send messages using generated sources -- even across languages -- to peers.

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

            QUESTION

            Flutter is it meaningless to upload debug symbols on obfuscating?
            Asked 2021-Dec-18 at 00:20

            I have uploaded a flutter obfuscating bundle to the play store. I have got the following warning:

            This App Bundle contains native code, and you've not uploaded debug symbols. We recommend that you upload a symbol file to make your crashes and ANRs easier to analyse and debug.

            Isn't it meaningless to obfuscate your app and then add debug symbols?

            The idea behind obfuscating is difficult reverse engineering by making the code unreadable. Does giving a debug symbols file the same as giving a decrypt obfuscating map?

            ...

            ANSWER

            Answered 2021-Dec-18 at 00:20

            Obfuscation is all about renaming your human-readable classes and functions into something meaningless to a human. Machines don't care about names but people trying to reverse engineer your code would have a much harder time.

            On the other hand, when your app crashes, the Google Play Developer Console would log this crash for you to inspect and debug. But as the final user has an obfuscated version of your app, the report sent to you is written with meaningless names and you cannot debug it.

            Now, the debug symbols map are used internally by the Play Console to resymbolize the crash report into human readable class names so you can debug it easily.

            TLDR: Upload the debug symbols. They allow you (the developer) to debug ofuscated crash reports and are only available (indirectly) to you, not people trying to reverse engineer your app

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install stadeo

            You can download it from GitHub.
            You can use stadeo like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            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/eset/stadeo.git

          • CLI

            gh repo clone eset/stadeo

          • sshUrl

            git@github.com:eset/stadeo.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 eset

            ipyida

            by esetPython

            malware-research

            by esetPython

            vba-dynamic-hook

            by esetPython

            slides

            by esetHTML