Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Protecting app against reverse engineering through static linking

Protecting app against reverse engineering through static linking

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 8 Posters 2.1k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wowalive
    wrote on last edited by
    #1

    Hi,
    i'am following a guide to protect our app against reverse engineering. As one of the easiest ways of protection static linking is listed. With static linking the application and Qt libraries are combined into a single binary which prevents simple swapping the Qt binaries used by the application and thus makes reverse engineering harder.

    But I've absolutely no idea how to achive that static linking for my application, especially no "easy" way. Do i need to build Qt from Source for that?

    The reason for my concern about obfuscating is, that a big part of our application is readable in plain text when opening the .exe with a Texteditor, especially the resources.

    Hope you can help me or give me some advices on how you protect your sourcecode.

    Greetings,

    PS: Ofc I'am using Qt commercial licence.

    JonBJ 1 Reply Last reply
    0
    • W Wowalive

      Hi,
      i'am following a guide to protect our app against reverse engineering. As one of the easiest ways of protection static linking is listed. With static linking the application and Qt libraries are combined into a single binary which prevents simple swapping the Qt binaries used by the application and thus makes reverse engineering harder.

      But I've absolutely no idea how to achive that static linking for my application, especially no "easy" way. Do i need to build Qt from Source for that?

      The reason for my concern about obfuscating is, that a big part of our application is readable in plain text when opening the .exe with a Texteditor, especially the resources.

      Hope you can help me or give me some advices on how you protect your sourcecode.

      Greetings,

      PS: Ofc I'am using Qt commercial licence.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Wowalive said in Protecting app against reverse engineering through static linking:

      The reason for my concern about obfuscating is, that a big part of our application is readable in plain text when opening the .exe with a Texteditor, especially the resources.

      If this is so, how do you think static linking will affect/alter that?

      1 Reply Last reply
      2
      • W Offline
        W Offline
        Wowalive
        wrote on last edited by
        #3

        Static linking was just the first step I stumbeled over while grappling with the topic of protecting the app against reverse engineering.

        JonBJ 1 Reply Last reply
        0
        • W Wowalive

          Static linking was just the first step I stumbeled over while grappling with the topic of protecting the app against reverse engineering.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Wowalive
          Well it won't do anything about being able to see your resources. You would have to start by not supplying resources, or external resource files, without encrypting them. Which makes resources unusable in your code, other than as a means to distribute encrypted binary data which would have to be unencrypted in memory, if the relevant Qt calls do not demand a file/resource for whatever operation.

          But I've absolutely no idea how to achive that static linking for my application, especially no "easy" way. Do i need to build Qt from Source for that?

          I don't think TQtC distributes static builds, at least not for Windows; and usually when people do not say anything about platform in their questions they assume Windows.... So I imagine, yes, you would need to build Qt statically from source yourself. I stand to be corrected if I am wrong about this.

          There are many hits if you Google for qt static libraries, e.g. https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW and many others.

          SPlattenS 1 Reply Last reply
          1
          • SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by SPlatten
            #5

            @Wowalive, If your executable is written in a compiled language then the source code is never visible in the compiled executable. The only part of your application that would be readable is plain text used by the application.

            Static linking only makes your executable larger and if you are using functions that other applications call in the DLL then its a waste of space.

            Anyone wishing to reverse engineer your work would have to do significantly more than just replacing a DLL.

            The binary is not human readable. It would require someone with a disassembler and a good understanding of the target assembly language to start reverse engineering.

            Kind Regards,
            Sy

            1 Reply Last reply
            0
            • JonBJ JonB

              @Wowalive
              Well it won't do anything about being able to see your resources. You would have to start by not supplying resources, or external resource files, without encrypting them. Which makes resources unusable in your code, other than as a means to distribute encrypted binary data which would have to be unencrypted in memory, if the relevant Qt calls do not demand a file/resource for whatever operation.

              But I've absolutely no idea how to achive that static linking for my application, especially no "easy" way. Do i need to build Qt from Source for that?

              I don't think TQtC distributes static builds, at least not for Windows; and usually when people do not say anything about platform in their questions they assume Windows.... So I imagine, yes, you would need to build Qt statically from source yourself. I stand to be corrected if I am wrong about this.

              There are many hits if you Google for qt static libraries, e.g. https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW and many others.

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #6

              @JonB , if anyone with has a commercial license for Qt then they have a choice of either shared object library linkage or static.

              Kind Regards,
              Sy

              JonBJ 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @JonB , if anyone with has a commercial license for Qt then they have a choice of either shared object library linkage or static.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @SPlatten
                Oh, so TQtC supplies punters with already built static libs if that's what they want? I saw stuff saying you had to build static for yourself, but perhaps that didn't take into account having a commercial licence?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  The Qt Company does not provide static builds.

                  Perhaps commercial customer can request them but to the best of my knowledge it's not part of the CI.

                  Some of the reasons (educated guess) for not providing static builds beside the size, additional build targets, tests and thus load on the people and infrastructure is that there are constraints for the GPL and LGPL that makes the use of static builds less than practical.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  SPlattenS 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    The Qt Company does not provide static builds.

                    Perhaps commercial customer can request them but to the best of my knowledge it's not part of the CI.

                    Some of the reasons (educated guess) for not providing static builds beside the size, additional build targets, tests and thus load on the people and infrastructure is that there are constraints for the GPL and LGPL that makes the use of static builds less than practical.

                    SPlattenS Offline
                    SPlattenS Offline
                    SPlatten
                    wrote on last edited by
                    #9

                    @JonB , @SGaist , Where I have been at clients with commercial licenses I have used static builds and I'm pretty sure the libraries were already built, this was using 5.12

                    Kind Regards,
                    Sy

                    jsulmJ J.HilkJ 2 Replies Last reply
                    0
                    • SPlattenS SPlatten

                      @JonB , @SGaist , Where I have been at clients with commercial licenses I have used static builds and I'm pretty sure the libraries were already built, this was using 5.12

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @SPlatten said in Protecting app against reverse engineering through static linking:

                      the libraries were already built

                      But by whom? I don't think the Qt Online/offline installer provides static libs (not even for commercial users).

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • SPlattenS SPlatten

                        @JonB , @SGaist , Where I have been at clients with commercial licenses I have used static builds and I'm pretty sure the libraries were already built, this was using 5.12

                        J.HilkJ Offline
                        J.HilkJ Offline
                        J.Hilk
                        Moderators
                        wrote on last edited by
                        #11

                        @SPlatten said in Protecting app against reverse engineering through static linking:

                        @JonB , @SGaist , Where I have been at clients with commercial licenses I have used static builds and I'm pretty sure the libraries were already built, this was using 5.12

                        as a commercial user myself I can say, with certainty, the qt company does not provide out of the box static Qt builds. The only exception here is iOS where dynamic linking is nearly impossible and the QtC therefore doesn't provide dynamic linked libraries


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        SPlattenS 1 Reply Last reply
                        1
                        • J.HilkJ J.Hilk

                          @SPlatten said in Protecting app against reverse engineering through static linking:

                          @JonB , @SGaist , Where I have been at clients with commercial licenses I have used static builds and I'm pretty sure the libraries were already built, this was using 5.12

                          as a commercial user myself I can say, with certainty, the qt company does not provide out of the box static Qt builds. The only exception here is iOS where dynamic linking is nearly impossible and the QtC therefore doesn't provide dynamic linked libraries

                          SPlattenS Offline
                          SPlattenS Offline
                          SPlatten
                          wrote on last edited by
                          #12

                          @J-Hilk , in which case someone at those premises must have built the static libraries from the source.

                          Kind Regards,
                          Sy

                          SPlattenS 1 Reply Last reply
                          0
                          • SPlattenS SPlatten

                            @J-Hilk , in which case someone at those premises must have built the static libraries from the source.

                            SPlattenS Offline
                            SPlattenS Offline
                            SPlatten
                            wrote on last edited by
                            #13

                            @SGaist , another reason I have previously gone for static builds is it makes deployment a lot easier without having to be concerned about including all the required shared libraries.

                            Kind Regards,
                            Sy

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SimonSchroeder
                              wrote on last edited by
                              #14

                              We use static linking (Qt self compiled on Windows) because we had trouble with deployment using DLLs (people tend to screw it up).

                              The only reason I see for using static builds for obfuscating your code is that you can strip symbols from your binaries. In static builds the computer does not have to know the function names. DLLs need them so you can look up functions by their names. Therefore, you cannot strip DLLs of their symbols. In this way your code could provide a lot of information to reverse engineers if you use meaningful function names and use short functions.

                              I suppose that Qt itself is not a trade secret. So, I don't see a point in statically linking Qt. You want your own code disguised and not calls to third-party code. This means you only need to make sure that your own code is statically linked and does not include function names. Not sure how the latter is done on Windows, though.

                              1 Reply Last reply
                              0
                              • W Offline
                                W Offline
                                Wowalive
                                wrote on last edited by
                                #15

                                Ok thanks for your replies. For me it seems that the efford-benefit ratio is not that high for using static linking as a protection against reverse engineering.
                                Especially our app runs on all platforms (Linux, MacOs, iOS, Windows, Android) and it seems that I have to build Qt from Sources for all platforms, right? Correct me when I'm wrong, but imho static linking isn't that easy to implement in my case and must be constantly maintained.

                                Furthermore I have read that there is no way to statically link when using WebEngine. Is this still a fact? We are using Qt 5.15 LTS and WebEngine is a main part of our application.

                                If my assumptions are correct, i tend to turn to other methods of obfuscation/protection.

                                JKSHJ 1 Reply Last reply
                                0
                                • W Wowalive

                                  Ok thanks for your replies. For me it seems that the efford-benefit ratio is not that high for using static linking as a protection against reverse engineering.
                                  Especially our app runs on all platforms (Linux, MacOs, iOS, Windows, Android) and it seems that I have to build Qt from Sources for all platforms, right? Correct me when I'm wrong, but imho static linking isn't that easy to implement in my case and must be constantly maintained.

                                  Furthermore I have read that there is no way to statically link when using WebEngine. Is this still a fact? We are using Qt 5.15 LTS and WebEngine is a main part of our application.

                                  If my assumptions are correct, i tend to turn to other methods of obfuscation/protection.

                                  JKSHJ Offline
                                  JKSHJ Offline
                                  JKSH
                                  Moderators
                                  wrote on last edited by
                                  #16

                                  @Wowalive said in Protecting app against reverse engineering through static linking:

                                  I have to build Qt from Sources for all platforms, right?

                                  Right.

                                  Furthermore I have read that there is no way to statically link when using WebEngine. Is this still a fact?

                                  Yes: https://doc.qt.io/qt-6/qtwebengine-platform-notes.html#building-qt-webengine-from-source

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  W 1 Reply Last reply
                                  3
                                  • JKSHJ JKSH

                                    @Wowalive said in Protecting app against reverse engineering through static linking:

                                    I have to build Qt from Sources for all platforms, right?

                                    Right.

                                    Furthermore I have read that there is no way to statically link when using WebEngine. Is this still a fact?

                                    Yes: https://doc.qt.io/qt-6/qtwebengine-platform-notes.html#building-qt-webengine-from-source

                                    W Offline
                                    W Offline
                                    Wowalive
                                    wrote on last edited by
                                    #17

                                    @JKSH Thank you. The fact that QtWebEngine does not support static builds speaks against implementing static linking for our app.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved