Skip to main content

Inappropriate coding practices


Classes are found with their fields defined as public, which does not respect the encapsulation principle.


Obtain and modify attributes that by definition should be private.


Set attributes as private and generate methods to access them.


Authorized user from the Internet.

Expected Remediation Time

⌚ 60 minutes.


Default score using CVSS 3.1. It may change depending on the context of the vulnerability.


  • Attack vector: N
  • Attack complexity: H
  • Privileges required: L
  • User interaction: N
  • Scope: U
  • Confidentiality: L
  • Integrity: L
  • Availability: N


  • Exploit code madurity: P
  • Remediation level: O
  • Report confidence: R


  • Vector string: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N/E:P/RL:O/RC:R
  • Score:
    • Base: 4.2
    • Temporal: 3.7
  • Severity:
    • Base: Medium
    • Temporal: Low

Code Examples

Compliant code

All attributes of the application clases should be defined as private

public class Main {
private double magnitude;
private String units;

public double getMagnitude() {
return magnitude;

Non compliant code

There are some public fields defined inside some classes of the application

public class Main {
public double magnitude;
private String units;


free trial

Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.