Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
final class Ser implements Serializable { 	
  private File f;
  public Ser() throws FileNotFoundException {
    f  = new File("c:\\filepath\\filename");
  }	 
}

...

Code Block
bgColor#ccccff
final class Ser { 	
  private File f;
  public Ser() throws FileNotFoundException {
    f  = new File("c:\\filepath\\filename");
  }	 
}

...

This compliant solution declares the File object transient. Consequently, the The file path is not serialized with the rest of the class and consequently is not exposed to attackers.

Code Block
bgColor#ccccff
final class Ser implements Serializable { 	
  private transient File f;
  public Ser() throws FileNotFoundException {
    f  = new File("c:\\filepath\\filename");
  }	 
}

...

Deserializing direct handles to system resources can allow the modification of the resources being referred to.

Bibliography

...