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
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
  • Like 2

Share this post


Link to post

Thank you!

 

I wasn't worried either. Until my application was rejected, citing the report of this service 😞

Share this post


Link to post

This reminds me of "registry cleaners" that do things like automatically remove entries that it determines are paths to files that no longer exist, as if it knows how those would be used if it even did understand how to properly check those things. I actually had this problem with some customers -- they used a snake-oil "registry cleaner" that was removing items my software needed from the registry, causing unexpected behavior. I told the customers that they were using software that was corrupting their system registry under the guise of "cleaning it" and if they needed to use my software, they'd have to stop running bogus "registry cleaners" that indiscriminately removed entries it did not understand. I moved on.

 

I have also dealt with virus scanners and false positives. One of the worst was/is "webroot" that would do more than report false-positives -- it disabled basic Windows functionality for any application it didn't understand, including the Windows clipboard. Hours of diagnosing problems that I should have been able to bill to webroot. In the end, I told the customers, don't use that horribly designed software unless you are willing to whitelist my software.

 

I do understand your problem is competitors whose software doesn't trigger these false-positives. But in the end all you can do is try to make this CrowdStrike's problem by making their customers aware of the issue and complain. After CrowdStrike bricked thousands of PCs across the globe I don't know why anyone would be willing to trust it any more, but I gather most of them are governments or companies fettered by government regulations, and where government bureaucracy exists, sanity and reason flees.

 

Maybe you can write a batch file that obfuscates the string in question post-build. It's not a Delphi bug and should not be treated as a bug in the RTL.

  • Like 2

Share this post


Link to post
5 hours ago, Brandon Staggs said:

After CrowdStrike bricked thousands of PCs across the globe I don't know why anyone would be willing to trust it

🔥

 

My problem is exclusively and only in CrowdStrike (not in clients, and certainly not in Delphi), but in the absence of ways to influence CrowdStrike, I am now trying to remove the line using Delphi, that's all.

 

It looks like I'm confusing cause and effect, I know, but I can't fight them alone 🙂

Share this post


Link to post

I thought they had gone under, due to gross incompetence. But as one can see, that is no reason to die as a business anymore...quite the opposite even.

Share this post


Link to post
14 hours ago, #ifdef said:

My problem is exclusively and only in CrowdStrike (not in clients, and certainly not in Delphi), but in the absence of ways to influence CrowdStrike, I am now trying to remove the line using Delphi, that's all.

If I had to do this, I would write a tiny little console app that replaces wine_get_version with some other deterministic text in a binary file, and add it as a build event. Then I would have to test the theory that the problem is that specific function name, rather than the code around it triggering some heuristics.

 

Writing a console app to do it would at build be less maintenance and headache than rebuilding the RTL to remove it.

Share this post


Link to post

One quick and extremely dirty solution for this issue would be to increase the executable size. That web page has a 100MB limit.

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

×