!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

120 Members
23 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
5 May 2025
@gggkiller:matrix.orgGGG* I don't know if anyone else has a better (or more reliable?) method to do it14:12:12
6 May 2025
@wiiplayer2:matrix.orgWaldemar Tomme (they/them)

Just a 5min guess: Could the output of binwalk help here?

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             ELF, 64-bit LSB shared object, AMD x86-64, version 1 (SYSV)
14137         0x3739          Unix path: /usr/share/dotnet

I did not investigate what's stored at that offset or if it even is at the same offset but this seems like it might be a bit more reliable...

06:12:20
@wiiplayer2:matrix.orgWaldemar Tomme (they/them)(I tried it on an already patched version because I did not have anything else lying around, so it might also be a red herring)06:13:16
@gggkiller:matrix.orgGGGhm, I'll check13:44:27
@gggkiller:matrix.orgGGGis the hex the offset?13:44:34
@corngood:corngood.comCorngood
        /// <summary>
        /// hash value embedded in default apphost executable in a place where the path to the app binary should be stored.
        /// </summary>
        private const string AppBinaryPathPlaceholder = "c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2";
        private static readonly byte[] AppBinaryPathPlaceholderSearchValue = Encoding.UTF8.GetBytes(AppBinaryPathPlaceholder);

this might be an option. it gets replaced with the dll name, but there's a separate copy of it in two parts that stays in the executable for comparison

13:45:06
@corngood:corngood.comCorngood *
        /// <summary>
        /// hash value embedded in default apphost executable in a place where the path to the app binary should be stored.
        /// </summary>
        private const string AppBinaryPathPlaceholder = "c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2";
        private static readonly byte[] AppBinaryPathPlaceholderSearchValue = Encoding.UTF8.GetBytes(AppBinaryPathPlaceholder);

this might be an option. it gets replaced with the dll name, but there's a separate copy of it in two parts that stays in the executable for comparison

it's also in singlefilehost

13:45:23
@corngood:corngood.comCorngood
#define EMBED_HASH_HI_PART_UTF8 "c3ab8ff13720e8ad9047dd39466b3c89" // SHA-256 of "foobar" in UTF-8
#define EMBED_HASH_LO_PART_UTF8 "74e592c2fa383d4a3960714caef0c4f2"
#define EMBED_HASH_FULL_UTF8    (EMBED_HASH_HI_PART_UTF8 EMBED_HASH_LO_PART_UTF8) // NUL terminated

bool is_exe_enabled_for_execution(pal::string_t* app_dll)
{
    constexpr int EMBED_SZ = sizeof(EMBED_HASH_FULL_UTF8) / sizeof(EMBED_HASH_FULL_UTF8[0]);
    constexpr int EMBED_MAX = (EMBED_SZ > 1025 ? EMBED_SZ : 1025); // 1024 DLL name length, 1 NUL

    // Contains the EMBED_HASH_FULL_UTF8 value at compile time or the managed DLL name replaced by "dotnet build".
    // Must not be 'const' because std::string(&embed[0]) below would bind to a const string ctor plus length
    // where length is determined at compile time (=64) instead of the actual length of the string at runtime.
    static char embed[EMBED_MAX] = EMBED_HASH_FULL_UTF8;     // series of NULs followed by embed hash string

    static const char hi_part[] = EMBED_HASH_HI_PART_UTF8;
    static const char lo_part[] = EMBED_HASH_LO_PART_UTF8;

13:46:56

Show newer messages


Back to Room ListRoom Version: 9