Summary
NukeViet CMS allows a super-administrator to configure an existing PHP function as a custom profile-field callback without restricting the selection to approved functions. When the field is later validated, the stored callback is invoked; a dangerous selection could execute commands as the web-server account, and ordinary users may be able to trigger it through normal field validation.
Affected context
The issue occurs in NukeViet CMS custom profile-field handling when a super-administrator configures a callback through the user-fields administration interface. The callback name is checked for existence but is not limited to a safe set of functions, and the selected function is later invoked during registration or profile validation. Risk depends on administrative access to configure the field and on whether a hazardous callback is stored; ordinary users may then trigger it through affected validation flows. A malicious callback already stored in the database may remain after application code is updated and require separate cleanup.
Exploit preconditions
- Attack surface: Custom profile-field configuration and validation in the Users module
- Required access to configure: Super-administrator access satisfying the
NV_IS_SPADMINgate - Trigger point: Registration, profile editing, or administrator editing that validates the configured field
- Required state: A hazardous existing PHP function has been saved as the field's callback
- Why exploitation is possible: The callback is selected based on a function name that is checked for existence but not restricted by an allowlist, then invoked dynamically
Why this happens
The application accepts a function name as configuration and passes it to a dynamic invocation mechanism after checking only that the function exists. This is an instance of CWE-470: Use of Externally-Controlled Input to Select Classes or Code, and can also enable CWE-94: Improper Control of Generation of Code when the selected function performs command execution. The underlying insecure pattern is treating a configurable identifier as safe executable behavior without restricting it to intended callbacks.
Potential impact
- A selected command-execution function could run operating-system commands as the web-server account.
- The web application or its data may be compromised.
- An ordinary user who can reach an affected validation flow may trigger a callback configured by an administrator.
- A malicious callback stored before remediation could remain active until the database entry is reviewed and cleaned.
General mitigation guidance
Defensive approaches focus on limiting which behavior configuration can select and reducing the trust placed in stored callback names.
- Use a strict allowlist of application-defined callbacks rather than accepting arbitrary existing function names.
- Prefer explicit, non-executable validation rules or declarative field constraints over dynamic function invocation.
- Validate callback settings when they are saved and again before use, with safe defaults for missing or invalid values.
- Review and remove unexpected callback values from persistent configuration after applying code-level remediation.
- Limit super-administrator access and run the web-server process with the least privileges necessary.
How teams detect issues like this
- Search code for user- or administrator-configurable function names passed to
function_exists()and then to dynamic invocation APIs such ascall_user_func(). - Review custom profile-field settings for callback values outside an approved set, including values persisted in the database.
- Use static-analysis rules and code-review checks to flag dynamic function calls whose targets are derived from stored configuration.
- Enforce policies that require callback registries or allowlists for configurable behavior, and monitor relevant settings for unexpected changes.

