Is Embedding-as-a-Service Safe? Meta-Prompt-Based Backdoor Attacks for User-Specific Trigger Migration

Gaurav Bagwe, Lan Zhang, L. Jay Guo, Miao Pan, Xiaolong Ma, Xiaoyong YuanTransactions 2025

Embedding-as-a-Service (EaaS) has become a cornerstone of modern AI integration. Platforms like OpenAI and Google provide Large Language Embedding Models (LLEMs) via APIs, allowing users to convert text into high-dimensional vectors (embeddings) to train local, task-specific classifiers for applications like sentiment analysis or spam detection. However, this paradigm relies on an implicit trust in the service provider.

Recent research introduces BadEmd, a meta-prompt-based backdoor attack that reveals how a malicious provider can manipulate downstream user predictions with near 100% success rates while remaining virtually undetectable.

The Vulnerability of EaaS

Traditional "task-agnostic" backdoor attacks, where a model is poisoned during pre-training to respond to a specific trigger, often fail in the EaaS context. These failures stem from three primary challenges:

  1. Attack Efficacy: Fixed associations between triggers and embeddings do not adapt well to the diverse, unknown tasks users might perform.
  2. Stealthiness: Modifying global model weights to attack one user might degrade performance for others, alerting the system to tampering.
  3. Limited Knowledge: In EaaS, the attacker (the provider) does not know the user’s specific labels or the architecture of the local classifier.
The EaaS workflow under clean conditions versus a backdoor attack scenario.

The BadEmd Framework

BadEmd overcomes these hurdles through two sophisticated modules designed to compromise multiple users while preserving the core functionality of the EaaS platform:

Meta-Prompt-Based Attack Buildup

Instead of fine-tuning the entire LLEM, which would be computationally expensive and easy to detect, the attacker utilizes "soft prompts"—learnable vectors added to the input. By employing meta-learning, the attacker creates a "meta-prompt" that can quickly adapt to any new downstream task. This acts as a "plug-and-play" attack surface that keeps the base model's weights frozen and its clean performance intact.

User-Specific Trigger Migration

To address the attacker’s lack of knowledge regarding the user's local classifier, BadEmd uses Iterative Classifier Estimation. The attacker trains multiple "surrogate" classifiers to mimic potential user behavior. A shuffling-based training strategy then reuses a small amount of labeled data to "migrate" the backdoor trigger so it maps specifically to the target label the attacker wishes to force (e.g., misclassifying spam as "not spam").

Experimental Evaluation

The researchers evaluated BadEmd across several standard NLP benchmarks, including SST5 (sentiment), AGNEWS (news classification), Yahoo Answer Topics, and Dbpedia. The attack proved remarkably robust, even when the attacker's surrogate classifier architecture differed from the user's actual local model.

Performance comparison of BadEmd against state-of-the-art attacks across four major datasets.

Key Results

As shown in the experimental data, BadEmd significantly outperforms existing state-of-the-art task-agnostic attacks such as Neuba, POR-2, and UOR:

  • Attack Success Rate (ASR): On the SST5 and AGNEWS datasets, BadEmd achieved a 100% ASR, meaning every query containing the trigger was successfully manipulated.
  • Clean Accuracy (CA): The attack maintained high performance on normal queries. For instance, on SST5, BadEmd achieved 48.55% CA (compared to 52.17% for a clean model), whereas previous attacks like Neuba dropped accuracy significantly to 40.90%.
  • Defense Resilience: The attack remained effective against the ONION defense, a common method for detecting backdoors by identifying "outlier" words. BadEmd maintained an ASR of over 87% even under active defense.

Conclusion

BadEmd flips the traditional threat model of backdoor research; rather than users poisoning a model, the service provider becomes the adversary. By leveraging meta-learning and soft prompts, attackers can achieve classifier-agnosticism and high efficiency. While currently focused on classification tasks and "rare word" triggers, this research highlights a critical need for new security protocols in the EaaS ecosystem to protect users from malicious providers.

Summary updated

Abstract

Article Is Embedding-as-a-Service Safe? Meta-Prompt-Based Backdoor Attacks for User-Specific Trigger Migration Gaurav Bagwe 1,*, Lan Zhang 1, Linke Guo 1, Miao Pan 2, Xiaolong Ma 1 and Xiaoyong Yuan 1 1 Department of Electrical and Computer Engineering, Clemson University, Clemson, SC 29634, USA 2 Department of Electrical and Computer Engineering, University of Houston, Houston, TX 77204, USA * Correspondence: [email protected] Received: 20 September 2024; Revised: 18 November 2024; Accepted: 20 December 2024; Published: 9 January 2025 Abstract: Embedding-as-a-Service (EaaS) has emerged as a popular paradigm for empowering users with limited resources to leverage large language models (LLMs). Through an API, EaaS providers grant access to their large language embedding models (LLEMs), enabling users with domain expertise to construct the domain-specific layers locally. However, the close interaction between EaaS providers and users raises new concerns: Is EaaS safe for users? Although recent research has highlighted the vulnerability of LLMs to backdoor attacks, especially task-agnostic backdoor attacks, existing attacks cannot be effectively executed in EaaS due to challenges in terms of attack efficacy, attack stealthiness, and user-side knowledge limitations. To unveil backdoor threats specific to EaaS, this paper proposes a novel backdoor attack named BadEmd, designed to effectively compromise multiple EaaS users while preserving the functionality of EaaS. BadEmd comprises two key modules: meta-prompt-based attack buildup creates backdoor attack surfaces in EaaS while seamlessly integrating with prior task-agnostic attacks to ensure attack stealthiness; user-specific trigger migration enforces attack efficacy despite limited user-side knowledge. Extensive experiments demonstrate the success of BadEmd across various user tasks.
BibTeX
@article{bagwe2025is,
  author = {Gaurav Bagwe and Lan Zhang and L. Jay Guo and Miao Pan and Xiaolong Ma and Xiaoyong Yuan},
  title = {{Is Embedding-as-a-Service Safe? Meta-Prompt-Based Backdoor Attacks for User-Specific Trigger Migration}},
  journal = {Transactions},
  year = {2025},
  doi = {10.53941/tai.2025.100002},
}
Figure