<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83" -->

---
title: Beware of the wildcard | daily.dev
description: Wildcard pattern sets in YARA rules, such as `any of ($s*)` or `2 of ($b*)`, can silently create logic bugs when prefixes overlap—for example, `$bd1` and...
canonical: https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Beware of the wildcard | daily.dev
og:description: Wildcard pattern sets in YARA rules, such as `any of ($s*)` or `2 of ($b*)`, can silently create logic bugs when prefixes overlap—for example, `$bd1` and...
og:url: https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83
og:image: https://api.daily.dev/og/posts/CNnZ5Ig83.png
og:image:alt: Beware of the wildcard
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Beware of the wildcard

**[YARA-X](https://daily.dev/sources/yara-x)** · 3 min read · 0 upvotes · 0 comments

## Summary

Wildcard pattern sets in YARA rules, such as `any of ($s*)` or `2 of ($b*)`, can silently create logic bugs when prefixes overlap—for example, `$bd1` and `$bd2` unintentionally satisfying a `2 of ($b*)` condition meant for `$b1` through `$b5`. This kind of collision turns out to be common in real-world VirusTotal rules. A new compiler warning called `unintended_pattern_in_set` has been built for YARA-X to catch these overlapping prefix issues automatically, and it will ship in the upcoming YARA-X v1.20.0 release.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://virustotal.github.io/yara-x/blog/beware-of-the-wildcard>

## Questions this post answers

### Why does my YARA rule with `2 of ($b*)` and `1 of ($bd*)` not behave as expected?

The wildcard `$b*` matches every pattern starting with `$b`, including `$bd1` and `$bd2`, not just the intended `$b1` through `$b5`. If both `$bd1` and `$bd2` are present, they alone satisfy `2 of ($b*)`, making the `$b1`-`$b5` patterns unnecessary; if only one is present, just a single `$b1`-`$b5` match is needed instead of two.

_daily.dev surfaces write-ups like this for teams hardening detection rule logic before it ships._

### What new compiler warning is coming in YARA-X v1.20.0?

YARA-X v1.20.0 will introduce an unintended_pattern_in_set compiler warning that detects overlapping wildcard prefixes and pattern set collisions, such as a variable like $this being unintentionally matched by a wildcard set like $t*. This catches silent logic bugs in rule conditions that previously required manual inspection to find.

_Track upcoming YARA-X releases like this one on daily.dev before rolling out rule changes._

## Similar posts on daily.dev

- [CVE-2026-45756: JsonPath Evaluates Attacker-Controlled Regular Expressions in match\(\)/search\(\) Without Limits: ReDoS \(Symfony Blog\)](https://daily.dev/posts/cve-2026-45756-jsonpath-evaluates-attacker-controlled-regular-expressions-in-match-search-witho-orpmyxxfl) · Symfony · 0 upvotes · 0 comments
- [A proactive defense against npm supply chain attacks](https://daily.dev/posts/a-proactive-defense-against-npm-supply-chain-attacks-hy7knvkqx) · InfoWorld · 0 upvotes · 0 comments
- [Finding Bugs](https://daily.dev/posts/finding-bugs-fgpoo3ipp) · matklad · 2 upvotes · 0 comments
- [CVE-2026-21876 — Root cause, Reproduction, Impact and Lessons Learned](https://daily.dev/posts/cve-2026-21876-root-cause-reproduction-impact-and-lessons-learned-mevczwwji) · InfoSec Write-ups · 0 upvotes · 0 comments
- [The dark figure of supply chain detection](https://daily.dev/posts/the-dark-figure-of-supply-chain-detection-zp2a6otbz) · Aikido Security · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#malware](https://daily.dev/tags/malware)

[View this post on daily.dev](https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Beware of the wildcard","url":"https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83"},"datePublished":"2026-08-23T12:23:27.315Z","dateModified":"2026-08-23T12:59:47.219Z","description":"Wildcard pattern sets in YARA rules, such as `any of ($s*)` or `2 of ($b*)`, can silently create logic bugs when prefixes overlap—for example, `$bd1` and...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"YARA-X","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"YARA-X","logo":"https://media.daily.dev/image/upload/s--PuWW0skn--/f_auto,q_auto/v1787487499/logos/yara-x?_a=BAMAMicg0","url":"https://daily.dev/sources/yara-x"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,malware","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"YARA-X","item":"https://daily.dev/sources/yara-x"},{"@type":"ListItem","position":3,"name":"Beware of the wildcard"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/beware-of-the-wildcard-cnnz5ig83#faq","mainEntity":[{"@type":"Question","name":"Why does my YARA rule with `2 of ($b*)` and `1 of ($bd*)` not behave as expected?","acceptedAnswer":{"@type":"Answer","text":"The wildcard `$b*` matches every pattern starting with `$b`, including `$bd1` and `$bd2`, not just the intended `$b1` through `$b5`. If both `$bd1` and `$bd2` are present, they alone satisfy `2 of ($b*)`, making the `$b1`-`$b5` patterns unnecessary; if only one is present, just a single `$b1`-`$b5` match is needed instead of two. daily.dev surfaces write-ups like this for teams hardening detection rule logic before it ships."}},{"@type":"Question","name":"What new compiler warning is coming in YARA-X v1.20.0?","acceptedAnswer":{"@type":"Answer","text":"YARA-X v1.20.0 will introduce an unintended_pattern_in_set compiler warning that detects overlapping wildcard prefixes and pattern set collisions, such as a variable like $this being unintentionally matched by a wildcard set like $t*. This catches silent logic bugs in rule conditions that previously required manual inspection to find. Track upcoming YARA-X releases like this one on daily.dev before rolling out rule changes."}}]}
```

