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. How to hide shared memory ?
Forum Updated to NodeBB v4.3 + New Features

How to hide shared memory ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 7 Posters 2.2k Views
  • 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.
  • aha_1980A aha_1980

    @davidlabib

    What are you trying to achive? If someone has access to your machine, its nearly useless to hide anything.

    1. I can decode Base64 without problems
    2. When you need it, you decode it. Where is it stored? In memory? I can read it.
    3. You do a network request. I can capture all you network requests with Wireshark.

    There is no safety if I have access to your machine.

    Regards

    ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #7

    @aha_1980

    @jondoe said in How to hide shared memory ?:

    I getting web site content from url but I see this url in my program when I searching with memory scanner.

    He said memory scanner not network scanner

    @aha_1980 said in How to hide shared memory ?:

    1. You do a network request. I can capture all you network requests with Wireshark.

    @aha_1980 said in How to hide shared memory ?:

    1. I can decode Base64 without problems

    any one can decode base64 easily that's why i said "i have a solution but it's not 100% secure"

    @aha_1980 said in How to hide shared memory ?:

    1. When you need it, you decode it. Where is it stored? In memory? I can read it.

    you can read it but it will be base64
    you will not know that this is the url unless you decode it

    I am not an expert but these answers are as far as I know

    jsulmJ 1 Reply Last reply
    0
    • ? A Former User

      @aha_1980

      @jondoe said in How to hide shared memory ?:

      I getting web site content from url but I see this url in my program when I searching with memory scanner.

      He said memory scanner not network scanner

      @aha_1980 said in How to hide shared memory ?:

      1. You do a network request. I can capture all you network requests with Wireshark.

      @aha_1980 said in How to hide shared memory ?:

      1. I can decode Base64 without problems

      any one can decode base64 easily that's why i said "i have a solution but it's not 100% secure"

      @aha_1980 said in How to hide shared memory ?:

      1. When you need it, you decode it. Where is it stored? In memory? I can read it.

      you can read it but it will be base64
      you will not know that this is the url unless you decode it

      I am not an expert but these answers are as far as I know

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

      @davidlabib said in How to hide shared memory ?:

      you can read it but it will be base64

      But YOUR application will decode it before using, right? At that point it is NOT encoded anymore.

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

      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #9

        @jsulm
        See this code

        //Encodeing the the url
        QByteArray url;
        url = “http://www.example.org”;
        QByteArray b64 = url.toBase64();
        //Show the encoded url
        qDebug() << b64; // "aHR0cDovL3d3dy5leGFtcGxlLm9yZw==”
        //Show the decoded url without puting it in a variable
        qDebug() << QByteArray::fromBase64(b64); // “http://www.example.org”

        He can use "QByteArray::fromBase64(b64)" as it's every time you need to decode without puting it in a variable
        So it will not be in the stack

        I didn't test the code it might be wrong but this just to simplification my idea

        jsulmJ JonBJ 2 Replies Last reply
        0
        • ? A Former User

          @jsulm
          See this code

          //Encodeing the the url
          QByteArray url;
          url = “http://www.example.org”;
          QByteArray b64 = url.toBase64();
          //Show the encoded url
          qDebug() << b64; // "aHR0cDovL3d3dy5leGFtcGxlLm9yZw==”
          //Show the decoded url without puting it in a variable
          qDebug() << QByteArray::fromBase64(b64); // “http://www.example.org”

          He can use "QByteArray::fromBase64(b64)" as it's every time you need to decode without puting it in a variable
          So it will not be in the stack

          I didn't test the code it might be wrong but this just to simplification my idea

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

          @davidlabib said in How to hide shared memory ?:

          So it will not be in the stack

          It will be there. fromBase64 returns a QByteArray and on most platforms it will be returned using stack. And the byte array containing the actual data will be on the heap as far as I know.
          And stack is not only memory you have (there is heap as well).
          But more important: this is rather trivial example. To use a URL you would need to pass it to some functions...

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

          1 Reply Last reply
          1
          • ? A Former User

            @jsulm
            See this code

            //Encodeing the the url
            QByteArray url;
            url = “http://www.example.org”;
            QByteArray b64 = url.toBase64();
            //Show the encoded url
            qDebug() << b64; // "aHR0cDovL3d3dy5leGFtcGxlLm9yZw==”
            //Show the decoded url without puting it in a variable
            qDebug() << QByteArray::fromBase64(b64); // “http://www.example.org”

            He can use "QByteArray::fromBase64(b64)" as it's every time you need to decode without puting it in a variable
            So it will not be in the stack

            I didn't test the code it might be wrong but this just to simplification my idea

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #11

            @davidlabib
            The user asked about someone not being able to recognise strings with a memory scanner or similar. Are you aware that as soon as you write the line in your code:

            url = “http://www.example.org”;
            

            that string is compiled into the executable's data area (rather than the stack/heap)? It does not matter that afterward you .toBase64() it. That means I can just strings on your executable and see it, or I can scan memory at runtime to see it....

            If you really wanted to bother doing this, the correct way is to do the toBase64(); manually at development time and then store the encoded string as a literal in the code, not the plain text. Which is an awful lot of hassle....

            1 Reply Last reply
            2
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #12

              @jsulm yes i know heap but stack is most used
              @JonB I wasn't know about the executable area
              I built my idea without considering the executable area

              jsulmJ 1 Reply Last reply
              0
              • ? A Former User

                @jsulm yes i know heap but stack is most used
                @JonB I wasn't know about the executable area
                I built my idea without considering the executable area

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

                @davidlabib said in How to hide shared memory ?:

                yes i know heap but stack is most used

                It doesn't matter what is most used, as soon as it is as clear text somewhere in the memory you can read it

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

                1 Reply Last reply
                1
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #14

                  In general I have explained my idea that may be right or wrong

                  JonBJ 1 Reply Last reply
                  0
                  • ? A Former User

                    In general I have explained my idea that may be right or wrong

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by JonB
                    #15

                    @davidlabib
                    As I said, if you/the OP does want to use that idea, and expect any kind of hidden, you must implement it by doing the url.toBase64(); manually yourself outside of your app at design-time when you are writing the code, and then put the encoded result into your source code appropriately. Then the runtime code calls just the fromBase64() when it needs to decode the string temporarily.

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by A Former User
                      #16

                      I think that my idea is not a good idea even after @JonB editing, Is there are more efficient way to solve the problem?

                      1 Reply Last reply
                      0
                      • VRoninV Offline
                        VRoninV Offline
                        VRonin
                        wrote on last edited by
                        #17

                        Another idea is to scramble your string around the memory so that a memory scanner can't easily work the order out. QString and QByteArray use adjacent memory segments.

                        QVector<QChar*> urlString{{ 
                        , new QChar('h')
                        , new QChar('t')
                        , new QChar('t')
                        , new QChar('p')
                        , new QChar(':')
                        , new QChar('/')
                        , new QChar('/')
                        , new QChar('w')
                        , new QChar('w')
                        , new QChar('w')
                        , new QChar('.')
                        , new QChar('e')
                        , new QChar('x')
                        , new QChar('a')
                        , new QChar('m')
                        , new QChar('p')
                        , new QChar('l')
                        , new QChar('e')
                        , new QChar('.')
                        , new QChar('o')
                        , new QChar('r')
                        , new QChar('g')
                        }};
                        

                        Should not be readable by a memory scanner

                        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                        ~Napoleon Bonaparte

                        On a crusade to banish setIndexWidget() from the holy land of Qt

                        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