Summary
A SQL injection flaw in Yonyou KSOA 9.0 allows attackers to manipulate the zpjhid parameter in /kp/PrintZPYG.jsp to inject arbitrary SQL into backend database queries.
When exposed over the network without effective input validation or query parameterization, this can be exploited remotely to read, modify, or destroy application data.
Affected context
This vulnerability occurs in Yonyou KSOA 9.0 within the web endpoint /kp/PrintZPYG.jsp, where the zpjhid request parameter is incorporated into database queries.
It is typically present when the application builds SQL statements dynamically using user-supplied request parameters without proper sanitization, validation, or parameter binding.
The issue is most relevant in deployments where this JSP is reachable from untrusted networks (e.g., internet-facing KSOA instances) and database accounts have broad privileges.
Exploit preconditions
- Attack surface: HTTP(S) interface of the Yonyou KSOA 9.0 application.
- Required access: Network access to the
/kp/PrintZPYG.jspendpoint; no prior authentication may be required if the page is publicly accessible. - Trigger point: Supplying crafted values for the
zpjhidparameter in a request to/kp/PrintZPYG.jspthat are concatenated into SQL statements. - Why exploitation is possible: The server-side logic likely constructs SQL queries using string concatenation or equivalent mechanisms without parameterized queries or robust input handling, allowing attacker-controlled input to alter query structure.
Why this happens
The core issue aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Application code appears to integrate the zpjhid parameter directly into SQL statements rather than treating it as data, enabling user input to influence query syntax.
This is often implemented through string concatenation or templated SQL without bound parameters, and without sufficient neutralization of metacharacters.
In addition, aspects of CWE-74: Improper Neutralization of Special Elements in Output are implicated, as the system fails to neutralize special characters before using them in a database context.
Collectively, this insecure pattern turns an otherwise data-only parameter into a control channel over database operations.
Potential impact
- Attackers may read sensitive information from database tables, including business data and potentially user records.
- Database content can be modified, inserted, or deleted, impacting integrity of financial, operational, or audit data.
- Application authentication and authorization data may be altered, enabling privilege escalation or account takeover where such data is stored in the same database.
- Under permissive database configurations, attackers can interact with underlying database features to access server files or execute administrative functions.
- Service availability may be disrupted through destructive queries, such as dropping tables or locking critical resources.
General mitigation guidance
Mitigation typically involves both code-level and architectural hardening focused on treating all client inputs as untrusted.
Recommended defensive patterns include:
- Refactoring database access code to use parameterized queries or prepared statements, ensuring that user input is always bound as data rather than concatenated into SQL strings.
- Enforcing strict server-side validation on
zpjhidto ensure it conforms to expected formats (e.g., numeric or constrained identifier) before reaching the data access layer. - Centralizing query construction behind a data access layer or ORM configured to escape or parameterize values by default.
- Applying least-privilege principles to the database account used by the application so that only necessary operations (SELECT/INSERT/UPDATE) on required tables are allowed.
- Implementing generic input handling and encoding policies for web parameters, discouraging ad hoc SQL assembly scattered across JSPs and controllers.
- Where feasible, constraining access to sensitive JSP endpoints through authentication and network segmentation to reduce exposure.
How teams detect issues like this
Detection efforts can focus on both code and runtime behavior:
- Static analysis: Use scanners or custom rules to flag dynamic SQL construction patterns, such as string concatenation with request parameters or expression language that interpolates user input into queries.
- Code review: Examine JSPs and backend handlers that read request parameters (e.g.,
zpjhid) and verify that all database calls use bound parameters and robust validation; pay attention to legacy JDBC, scriptlets, or inline SQL fragments. - Security testing: Conduct targeted penetration tests and fuzzing against
/kp/PrintZPYG.jsp, observing for SQL error messages, anomalous responses, or behavioral differences when injecting SQL metacharacters. - Database monitoring: Enable query logging and anomaly detection at the database layer to identify unusual query patterns, especially those containing user-controlled values in unexpected locations.
- Policy enforcement: Incorporate secure coding standards into CI pipelines that disallow new direct string-based SQL assembly, supplemented with automated review tools to enforce these policies.

