dcsimg
Results 1 to 4 of 4

Thread: Help with coding / XSS vulnerabilites

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2019
    Posts
    2

    Help with coding / XSS vulnerabilites

    I have some code, giving just the snippets since it's very involved in the middle bits...

    (lots of page code here)

    do stuff, and things, user clicks a button
    Code:
    Protected Sub btnSwitch_Click(sender As Object, e As EventArgs) Handles btnSwitch.Click
            Response.Redirect("OtherPage.aspx?ID=" + tbxHidden.Text + "&view=" + tbxViewHidden.Text)
    End Sub
    This is giving me the error that it unvalidated (even though it's chosen based on a click choice). How do I fix it? The problem is that the hiddentextbox value changes based on what the user clicks on, and there are over 100 options...

    and then on the other side, the receiving page says that it is XSS vulnerable because it needs to use the value sent to query for information...

    on new page
    Code:
    hiddentextbox.Text = Request.QueryString("ID")
    tbxViewHidden.Text = Request.QueryString("view")
    db.executedataset("Getmydata", ID)
    then draw page

    and then from this, the user can click again, sending the ID yet again to another page

    The ultimate goal is to not have the vulnerabilities of course... but i honestly have no idea how to fix them...
    Last edited by Shaggy Hiker; Mar 15th, 2019 at 03:02 PM. Reason: Added CODE tags.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,314

    Re: Help with coding / XSS vulnerabilites

    Welcome to the forums. Based on the question, I assume that this is ASP.NET rather than a desktop application. Therefore, I moved the thread to that forum. I also added [CODE][/CODE] tags to better format the code. You can do this by pressing the # button and pasting code between the tags.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2019
    Posts
    2

    Re: Help with coding / XSS vulnerabilites

    thank you

  4. #4
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,510

    Re: Help with coding / XSS vulnerabilites

    So your problem here is you are using a response.redirect AND building the redirect string which can leave vulnerabilities in your site where a hacker could potentially change your redirect string and push a user to somewhere else other than where you instead and do some damage.

    Have a read of this - https://portswigger.net/kb/issues/00...tion-reflected

    You have 2 ways round this either dont use response.redirect and instead use direct links OR continue to use response.redirect and instead of passing your data via the Query String instead store it in the Session. Storing you data in the session means it is available to all pages (and so will be available on your new page) until your session times out (you can set a session timeout length in your web config)
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width