Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrity Error Not Captured #9

Open
dz333 opened this issue Nov 7, 2019 · 1 comment
Open

Integrity Error Not Captured #9

dz333 opened this issue Nov 7, 2019 · 1 comment
Labels
bug Something isn't working v0.1 Issues that affect version v0.1 of secure-firrtl

Comments

@dz333
Copy link
Collaborator

dz333 commented Nov 7, 2019

Bug description: An untrusted input can modify data in a trusted array when the array index is untrusted.

Code example: In the code, tag1[N] is a trusted array, but the input "tag_in" and the address "index" are untrusted. Assignment "tag1[index] := tag_in" indicates that an untrusted input can affect the trusted data stored in the array, which is incorrect.

Possible solution?: "tag1[index]" should be treated as untrusted when it is a right value in an assignment because the data source is controlled by the adversary; while "tag1[index]" should be trusted when it is a left value in an assignment.

class ErrorExample extends Module {
  val io = IO(new Bundle {
    val way       = Input(UInt(1.W),    Label(Level("L"), Level("L")))
    val index     = Input(UInt(8.W),    Label(Level("L"), Level("L")))
    val tag_in    = Input(UInt(19.W),   Label(Level("L"), Level("L")))
    val write_en  = Input(UInt(1.W),    Label(Level("L"), Level("L")))
    val tag_out   = Output(UInt(19.W),  Label(Level("L"), Level("L")))
  })

  val tag0 = Reg(t=Vec(256, UInt(19.W)), lbl=Label(Level("L"), Level("L")))
  val tag1 = Reg(t=Vec(256, UInt(19.W)), lbl=Label(Level("H"), Level("H")))

  when (io.write_en === 1.U) {
    when (io.way === 0.U)       { tag0(io.index) := io.tag_in }
    .otherwise                  { tag1(io.index) := io.tag_in }
  }
}
@dz333 dz333 added bug Something isn't working v0.1 Issues that affect version v0.1 of secure-firrtl labels Nov 7, 2019
@dz333
Copy link
Collaborator Author

dz333 commented Nov 7, 2019

Affects v0.1 only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.1 Issues that affect version v0.1 of secure-firrtl
Projects
None yet
Development

No branches or pull requests

1 participant