Jump to content
#ifdef

Delphi + Windows + isWine

Recommended Posts

Do you remember that show last summer? 😶

 

Well. These same guys recently launched their own "VirusTotal" analog and, obviously, their new service is very stupid and dangerous too:

 

1859803663_36C7CC3A-2140-4067-B28C-4B004E4D1B08.thumb.png.f4d2bfef683efe53cb146ef0977cfb83.png

 

image.thumb.png.171861943060cf8790c7ff3590c180d5.png

 

 

 

 

 

But I suppose it's gaining popularity and/or is being actively promoted, because recently some clients (suffering from a special form of paranoia) started complaining: "VirusTotal" and "Hybrid Analysis" have started marking my signed (say "Hi" to CrowdStrike!) app as malicious:

 

1209955377_C9D295F2-F482-408A-BF41-430F659416C4.thumb.png.1b5b091913339bfabc9b788b4f5b3440.png

 

1808649790_ECDE47E4-6837-4459-B04F-67C7897708CF.thumb.png.cb4f5f8e645e4115b47695e713303973.png

 

 

 

 

 

As you can see, the problem is specifically with the "wine_get_version" string, which Delphi for some reason includes even in a completely empty EXE (to verify, you can create a new empty "VCL, 32-bit, Release" project without a single line of code):

 

1899073429_9E76816C-C405-46FF-96B1-DEDC87508067.thumb.png.36a97ff131df0dc806083e4c3eb55bc7.png

 

 

 

 

 

Of course I reported this to CrowdStrike, but these guys definitely know how to make a problem out of nothing:

 

1792199599_5F43C942-D295-4C4B-ADD0-EC2BEFC58768.thumb.png.536d6077d792a0be854c325aea5c8160.png

 

 

 

 

 

So... Any ideas why Delphi does this, and how to avoid it? I don't need the "IsWine" check from SysInit.pas, but I can't figure out how to disable it:

 

690177514_EC4EF537-E1F5-4417-A3D8-826306A251C4.thumb.png.2a958323d1f81e8f0e4617a75d307fb3.png

 

 

 



Yes, I know this string can be fixed in HEX, but I need a more reliable solution, I don't want to patch each of my files every release 🥲

Share this post


Link to post

The RTL looks for Wine as part of its check to know whether it can use the Win32 API to access TLS (thread local storage) data, instead of using direct access to the GS register.

Edited by Remy Lebeau

Share this post


Link to post

Ok, thank you.

 

And how can I permanently remove the "wine_get_version" string from my EXE? Because with this string CrowdStrike considers my EXE "malicious":

 

image.png.354716af174722ef859b55c9cabe2089.png

 

 

 

... but without this string (when I remove it in a HEX editor) it's just "suspicious"

 

image.png.60be1e7082983c7c4419c0c92e1cb914.png

 

 

 

 

 

I suspect that CrowdStrike has been reading others' blogs and set up a simple trigger for this string, thus shifting this burden from their head to mine, because Delphi adds this string to all EXEs by default 😞

 

Right now, I'm patching each file, but what if I want to both get rid of the string and don't want to patch the file each time?

Edited by #ifdef

Share this post


Link to post

I personally want my program to run on Wine. Seems like Crowdstrike is the problem.

 

Do you sign your executables? 

  • Like 2

Share this post


Link to post
3 hours ago, #ifdef said:

And how can I permanently remove the "wine_get_version" string from my EXE?

You can't, without patching the EXE or recompiling the RTL. Nor should you be doing so. You should be complaining to CrowdStrike instead. And code-signing your EXE.

  • Like 1

Share this post


Link to post

Of course, my code is signed:

 

555422329_6755A5C0-78B1-4D59-95E5-62D484F3C108.png.d2ad53e71fa77dd08c8e3100106fbd73.png

 

 

 

And it has always been signed:

 

1875120863_8E995E75-E0E8-409C-B07A-38755E00FCD3.thumb.png.aeddd6bf541ea1d49a67dbfa0122cdd2.png

 

 

 

 

 

And yes, I contacted CrowdStrike.

 

Everything is useless, that's why I'm here.

 

For the guys at CrowdStrike it doesn't matter how exactly the "wine_get_version" string is used — they hate the very fact of its presence, so by default they consider any executable file containing it to be "malicious". This is the root of the problem, but they don't see any problem with this approach and therefore have no intention of fixing it, they're completely fine with it 😑

Edited by #ifdef

Share this post


Link to post

Clients have a system for selecting the software they use: according to the rules and regulations, at the selection stage they are forced to give priority to software that is impeccable in terms of security. When selecting, they do not figure out whether the software is actually dangerous or not, the verdict of competent and proven online services is enough for them. If the online services unanimously recognize the file as safe, the software goes to the next stage, and so on. It's like a face control 🙂

 

These are their rules, I cannot change them. All that is required of me is simply to comply with them and provide code that 100% passes any security checks.

 

 

 

As is:

 

 image.thumb.png.20967eef5e14498ebad0bdfd10cb1a2c.png

 

 

 

 

 

Should be:

 

image.thumb.png.1a1be5b79b6bf1742c3df5d12c424a1c.png

Share this post


Link to post

In fact, the problem is idiotic, and it should not exist at all: CrowdStrike cannot even prove their false accusations (I asked what kind of danger this "wine_get_version" string carries and how exactly my application exploits it, but they, of course, ignored all my questions), but customers do not need any evidence from me — software from other providers successfully passes all checks, and my software is considered dangerous, and this is enough for any bureaucratic machine.

 

I would never trust a heuristic that considers a file version to be an IPv4 address, and moreover — considers "0.0.0.0" to be a valid IPv4 address:

 

9198657_36C7CC3A-2140-4067-B28C-4B004E4D1B08.png.aad4af1eb2d600959dfb5a3168aa78d3.png

 

 

But "the customer is always right" 🥲

Edited by #ifdef

Share this post


Link to post

Out of curiosity, I tried the CrowdStrike analyzer on the PyScripter setup program (signed).  Whilst Falcon and MetaDefender gave a clean record, their Falcon Sandbox report gave a threat score 100/100!

The report included the following:

 

This report has 268 indicators that were mapped to 106 attack techniques and 11 tactics
- Calls an API typically used to query local/system time as file time

- Reads configuration files (.ini files)

- Marks file for deletion

- Contains ability to load/free library (API string)

- Contains ability to modify registry key/value (API string)

- Contains ability to set file time (API string)

etc.

 

Micorsoft's "MicrosoftEdgeWebview2Setup.exe" fails miserably as well.

 

I am not sure any real-world compiled program would pass all these tests.  I don't think there is  much to worry about here.

 

Edited by pyscripter

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×