>_0xFORUM
Sign in

# Coding

unreadhot
Error enums vs strings in lab tools — I switched back to strings

I had a 40-variant error enum. Nobody matched on it. Display impl was the product. I went back to a string + a code…

bhdisbhdisMEMBERstarted 2 Mar 2026, 23:07
Last ReplygatherdatagatherdataFriday, 03:59
14posts2.9kviewsalpc_seamretwfp_syscallstor_invlpgio_sti5 reading
unreadhot
Tiny PE parser in Rust — no crates, just bytes

Tired of pulling goblin for throwaway lab tools. ~400 lines: DOS stub, COFF, optional header, section table, export…

mdlprobemdlprobeMEMBERstarted 26 Aug 2025, 12:53
Last ReplymicromicroThursday, 19:03
40posts6.7kviewshex_olgaalpc_seamretwfp_syscallstor_invlpg5 reading
unread
I refuse to parse HTML in a security tool

A vendor sent IOCs as an HTML table. I asked for CSV. They sent HTML. I used a real HTML parser with a size cap, on…

greygreyGUESTstarted 25 Aug 2026, 10:32
Last ReplyinstackinstackThursday, 11:44
10posts273viewsnt_inveptnt_msrndis_dr7alpc_wbinvd6 reading
Snapshot tests for disassembly output

I snapshot Capstone output on a corpus of public functions. A Capstone bump changed formatting and CI went red. Goo…

lenaetwlenaetwMEMBERstarted 23 Aug 2026, 22:41
Last ReplypassivepassiveTuesday, 03:30
11posts220viewswfp_syscallstor_invlpgio_stips_seamret9 reading
hot
Off-by-one in a bitset iterator I wrote from memory

Last bit of the last word. Tests used sizes % 64 != 0 except the one that mattered. Fuzzer found it on a 64-bit bou…

paveldbgpaveldbgMEMBERstarted 19 Jul 2026, 08:20
Last Replyshlddblshlddbl20 Aug 2026, 10:59
25posts754viewsob_inveptcm_rdrandndis_int3idtvec4 reading
A bitmap index for 10k YARA matches

I stored match offsets in a roaring bitmap. Query time dropped. Memory went up. Worth it for the lab dashboard. If …

wrpkruwrpkruMEMBERstarted 7 Jan 2026, 08:46
Last Replycrc32isacrc32isa18 Aug 2026, 05:13
19posts1.4kviewsnpagedex_epcpagestor_fs3 reading
hot
Don't roll your own base64, except I did, and here is why it failed

Whitespace in the alphabet. Padding rules. A URL-safe variant in one file. I used a crate after the third bug. The …

echoechoGUESTstarted 22 Jan 2026, 06:40
Last Replypopftrappopftrap16 Aug 2026, 13:25
16posts4.2kviewsex_epcpage1 reading
Go assembler in a lab hook — when gc is not enough

Needed a one-instruction stub. Go assembler, not Cgo. It was fine. The build tags were not. If you mix Go asm and c…

sgdtsgdtMEMBERstarted 15 Aug 2026, 20:28
Last Replyptesmearptesmear15 Aug 2026, 22:23
9posts194viewsint3loop1 reading
hot
I stopped using mmap for untrusted files

mmap a hostile file, then a truncating writer on another handle. You will have a bad day. I read() into a cap now. …

dirqldirqlMEMBERstarted 3 Sep 2025, 19:38
Last Replyasidrollasidroll11 Aug 2026, 06:14
34posts2.9kviewsnt_invept2 reading
hot
CRC32 as a hash and other crimes

Someone used CRC32 to key a map of modules. Collisions in the lab corpus. I switched to blake3 truncated. Checksums…

freshmodefreshmodeMEMBERstarted 2 Jul 2026, 17:51
Last Replysmmueventsmmuevent10 Aug 2026, 18:32
25posts1kviewsndis_vmxonollyholdex_sysret10 reading
The case for plain C in a lab parser

I rewrote a 3k-line C parser in Rust. It was nicer. The C version still ships because the firmware team will not ta…

kirillrrkirillrrMEMBERstarted 6 Aug 2026, 03:14
Last Replyfsgsbasefsgsbase8 Aug 2026, 02:10
11posts496viewsio_wbinvdnpagedex_epcpagestor_fs8 reading
hot
The smallest honest hexdump I will maintain

16 bytes per line, ASCII pane, offset. No colors. No plugins. I paste it into tickets. xxd is fine. I wanted one I …

ssbdssbdMEMBERstarted 20 Feb 2026, 07:52
Last Replyshowregsshowregs6 Aug 2026, 03:43
9posts2.7kviewsnt_xgetbvio_gske_dpcrootkit_ivan6 reading
hot
Fuzzing a parser I wrote, finding bugs I wrote, shipping anyway

libFuzzer, 12 hours, 4 crashes. All my fault. I fixed 3 and documented the 4th as 'do not do that'. If you ship a p…

vdsosymMEMBERstarted 1 Nov 2025, 05:20
Last Replydtors28 Jul 2026, 16:29
22posts1.9kviewsnt_msrndis_dr7alpc_wbinvdhexrays8 reading
Why my Rust PE crate rejects files over 64MB by default

Lab drop folders get huge by accident. A default cap made a colleague angry and then grateful. Caps are product fea…

dmitriredmitrireMEMBERstarted 26 Jul 2026, 06:43
Last Replymethodptrmethodptr27 Jul 2026, 13:43
12posts460viewsstor_invlpg1 reading
hot
Endianness bugs that only show on the ARM box

Parser written on x86, deployed on ARM64 CI. A u32 field was host-endian by accident. Tests were little-endian-only…

ibrsibrsMEMBERstarted 8 Feb 2026, 05:55
Last Replycancelrtncancelrtn22 Jul 2026, 09:12
6posts3.1kviewsse_xgetbvse_invvpidndis_vmxonollyhold9 reading
A grammar for a config language I should not have written

I wanted 'simpler than YAML'. I wrote a grammar. Users wrote YAML in it anyway. I vendored a YAML parser. Do not wr…

yukiuefiyukiuefiMEMBERstarted 13 Jul 2026, 10:21
Last Replyiommuiommu13 Jul 2026, 19:52
6posts416viewsalpc_ripalpc_tss3 reading
hot
A streaming ZIP reader that refuses zip bombs

Untrusted ZIP from a drop folder. I cap uncompressed size, entry count, and nested ZIPs. Then I still extract to a …

umipumipMEMBERstarted 4 Feb 2026, 00:34
Last Replylookasidelookaside7 Jul 2026, 10:35
7posts2.3kviewsndis_eresumehex_olgaalpc_seamretwfp_syscall8 reading
I ported a lab tool to WASI and I am not sure why

It worked. It was slower. The sandboxing was nice. I still run the native one. WASI is not a personality. It is a d…

ninafidninafidMEMBERstarted 19 Jun 2026, 00:23
Last Replyvxlabvxlab21 Jun 2026, 19:59
13posts1.3kviewsvolchokstor_mdl7 reading
String interning that hid a use-after-free

Intern table held pointers into a buffer I freed on reload. Looks like 'random corruption'. Was lifetime. If you in…

eliasetweliasetwMEMBERstarted 16 Jun 2026, 09:00
Last Replybhdisbhdis17 Jun 2026, 04:10
11posts715viewsob_eenter2 reading
hot
A 200-line Python PE dumper that replaced a 4MB GUI once

I needed exports and nothing else. The GUI took 20 seconds to open. The script printed them in 0.1. GUIs are for ex…

piotrpeMEMBERstarted 3 Jun 2026, 09:58
Last Replypstore4 Jun 2026, 05:56
11posts1.8kviewsollyholdex_sysretsoftlock5 reading
CLI flags I refuse to add anymore

--pretty, --color=always in a pipe, --force without a dry-run. I have been burned. Dry-run is default for destructi…

minhodbgMEMBERstarted 24 May 2026, 18:01
Last Replybtfid26 May 2026, 21:15
12posts719viewsidtvecalpc_ripalpc_tss6 reading
hot
Type confusion in a tagged union I designed

I stored a tag and a payload. A helper trusted the caller on the tag. The caller lied. Fuzzer found it. If the tag …

fola_adefola_adeSENIORvendorstarted 18 May 2026, 17:49
Last Replyxtestxtest23 May 2026, 09:45
24posts1.9kviewsndis_int3idtvecalpc_rip9 reading
hot
A schema for crash-dump metadata, not the dumps

CSV: bugcheck, image, build, license tag, hash. No full dumps in the zip. Pointers only. People keep asking for the…

colerecolereMEMBERstarted 4 May 2026, 15:13
Last Replyx64dbgbpx64dbgbp5 May 2026, 00:15
10posts1.6kviewsse_xgetbvse_invvpidndis_vmxon8 reading
hot
I will not parse XML with regex, and I will not parse XML

Config was XML. I converted it to a smaller JSON at ingest and threw the XML away. Life improved. If you can avoid …

nevanevaMEMBERstarted 14 Apr 2026, 00:19
Last Replytlscbtlscb15 Apr 2026, 17:59
12posts2.7kviewsps_seamretcm_cr3ob_inveptcm_rdrand4 reading
hot
Bounds-checked slice helpers I copy into every C tool

Three functions: need(n), take(n), remain(). Every parser bug I still write is because I did not use them. Paste yo…

zaryaMEMBERstarted 11 Apr 2026, 16:32
Last Replyrdtscprdtscp15 Apr 2026, 06:07
16posts2kviewsio_gske_dpcrootkit_ivan3 reading
hot
A Makefile that builds the same binary twice and diffs it

Reproducible build check as a test. Two dirs, same flags, cmp. It failed because of an embedded __DATE__. I killed …

sibirsibirMEMBERstarted 23 Mar 2026, 11:47
Last Replybtbaliasbtbalias30 Mar 2026, 00:59
28posts3.1kviewsstor_mdlnt_invept7 reading
hot
JSON that is actually NDJSON and a parser that assumed an array

Vendor 'JSON' log was NDJSON. My parser expected a list. I read the first 8KB and guessed. Guessed wrong. Sniff the…

molotmolotMEMBERstarted 28 Mar 2026, 09:04
Last Replyshadow_spbshadow_spb29 Mar 2026, 05:02
11posts2.5kviewsrootkit_ivanint3loopetw_stacob_mdl10 reading
hot
PE checksum: I still compute it, I still do not trust it

Optional header checksum. Easy to fix after a patch. I compute it so loaders do not shrug. I do not use it as integ…

kaktusMEMBERstarted 11 Mar 2026, 11:49
Last Replytebselftebself14 Mar 2026, 11:13
16posts3.5kviewsetw_stacob_mdl2 reading
hot
Portable PDB vs Windows PDB — I support both now

dotnet portable PDB in a mixed tree. My old PDB parser shrugged. I added the portable path. Tests against public sa…

lazyfpuMEMBERstarted 13 Jan 2026, 16:10
Last Replyxendxend14 Jan 2026, 06:07
8posts3.9kviewsalpc_wbinvdhexraysnt_xgetbvio_gs4 reading
hot
When serde is the bug, not the data

A deny_unknown_fields struct and a vendor added a field. We failed closed in a good way, then I had to ship a permi…

iommuMEMBERstarted 25 Dec 2025, 07:36
Last Replypcodevmpcodevm25 Dec 2025, 14:39
8posts2.8kviewsob_mdlvehchainob_dr7ke_hlt10 reading
hot
Parsing ELF notes without copying every string

I needed build-id and nothing else. Full ELF library was overkill. 80 lines, aligned reads, done. If you only need …

syzbotsyzbotMEMBERstarted 9 Dec 2025, 22:47
Last Replyiamflexiamflex20 Dec 2025, 00:32
42posts1.4kviewsalpc_tss2 reading
hot
UTF-16LE in PE resources — people still assume UTF-8

Version info strings. I treated them as UTF-8 and got mojibake in the lab UI. They are UTF-16LE. Always. I added a …

ramoopsMEMBERstarted 16 Dec 2025, 23:34
Last Replyfixupfixup18 Dec 2025, 00:39
10posts4.9kviewsnt_inveptnt_msr7 reading
A ring buffer that lost a slot and passed tests

Power-of-two buffer, claimed empty/full distinguished by a count, tests used even sizes. Odd size in production los…

rcustallrcustallMEMBERstarted 27 Nov 2025, 00:40
Last Replydmitriredmitrire28 Nov 2025, 07:53
8posts1.4kviewsob_eenterndis_eresumehex_olgaalpc_seamret5 reading
hot
CMake + clang-cl + sanitizers — the flags that actually stick

MSVC-looking flags on clang-cl silently dropped -fsanitize=address until I used the clang-cl form. Paste your worki…

kprobekprobeSENIORvendorstarted 20 Nov 2025, 12:50
Last Replybsrscanbsrscan22 Nov 2025, 02:28
11posts3.1kviewsob_dr7ke_hltob_eenter6 reading
hot
Varint decoding that disagreed with the spec by one bit

I implemented unsigned varint off a blog post. The blog post was wrong. The spec was not. Tests against a known-goo…

landlocklandlockMEMBERstarted 7 Nov 2025, 19:42
Last Replypopcntpopcnt8 Nov 2025, 16:42
12posts2.7kviewske_hltob_eenterndis_eresume9 reading
hot
A length-prefixed TLV that looked like protobuf from far away

It was not protobuf. I wasted a morning on protoc. It was a home-grown TLV with a 16-bit type and a 32-bit length. …

pieelfpieelfMEMBERstarted 19 Oct 2025, 12:38
Last Replyspidumpspidump20 Oct 2025, 00:22
7posts6.3kviews1 reading
hot
Capstone vs Zydis vs iced — one disasm for lab tools

I used all three this year. Capstone is everywhere. Zydis is nicer on x86. iced is what I reach for in Rust. Pick o…

retpolineretpolineMEMBERstarted 13 Oct 2025, 18:25
Last Replyttdposttdpos14 Oct 2025, 20:22
6posts3.9kviewsndis_dr7alpc_wbinvdhexraysnt_xgetbv4 reading
hot
Integer overflow in parsers: a hunting checklist without a file

Length field, then alloc, then copy. Saturating add in the patch. Hunt the old immediate. Grep your own trees. The …

xfghashxfghashMEMBERstarted 2 Oct 2025, 08:52
Last Replykdserialkdserial3 Oct 2025, 18:00
10posts6.7kviewsstor_fsvolchokstor_mdl3 reading
hot
Writing a COFF importer that does not become lld

I needed to load a .obj from a lab compiler. COMDATs will end you. If you see IMAGE_COMDAT_SELECT_*, close the edit…

cfgwatchcfgwatchMEMBERstarted 25 Sep 2025, 03:05
Last Replyuefivaruefivar27 Sep 2025, 01:35
11posts6.1kviewssoftlockio_wbinvdnpagedex_epcpage10 reading
hot
YARA on a drop folder: 800 rules without pegging a core

Hot set vs slow set. One Themida-shaped loop in the hot set and you are done. The fast/slow split is the whole game…

chkstkMEMBERstarted 17 Sep 2025, 05:53
Last Replysleighjitsleighjit18 Sep 2025, 19:03
11posts4.2kviewscm_rdrandndis_int3idtvec7 reading