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

OS-80: Fixed LFI issue with report generating. #145

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions IMIS/Registers.aspx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
'
'


Partial Public Class UploadICD
Inherits System.Web.UI.Page

Expand Down Expand Up @@ -384,7 +383,10 @@ Partial Public Class UploadICD
Private Sub DownloadFile(path As String, contentType As String)
Dim strCommand As String = ""
Dim file As System.IO.FileInfo = New System.IO.FileInfo(path)
If file.Exists Then
Dim settingsPath As String = System.Configuration.ConfigurationManager.AppSettings("ExportFolder").ToString()
' To prevent LFI exploit check if files comes from reports folder
' To prevent cases such as "exports\..\..\secret_file.txt" use getfullpath
If file.Exists And System.IO.Path.GetFullPath(path).Contains(settingsPath) Then
strCommand = "attachment;filename=" & System.IO.Path.GetFileName(path)
Response.AppendHeader("Content-Disposition", strCommand)
Response.ContentType = contentType
Expand Down