Gamma-hydroxybutyric acid (GHB) is one of the substances frequently used in sexual assault that has raised significant concerns in society. Its unique biological properties and the difficulty in detecting it when added to beverages are the main reasons for its misuse. In this work, we designed aminoquinazolinone derivatives with a nitro group as the key structural component, providing exceptional specificity for GHB. These compounds successfully overcome challenges related to interference from structurally similar substances and from compounds commonly found in beverages, with a specific detection mechanism for both the hydroxyl and carboxylate groups present in the GHB structure. The compounds enable facile and rapid measurement without the need for pretreatment steps prior to the GHB measurement, with the result observed by naked eye. The chemosensor probe for GHB detection developed demonstrates the potential of a solution and paper-based analysis formats.