OK, thatโs what I think is the solution: PageIIPostBack is already quite safe as long as event checking is enabled. Let me explain my reasoning below, and I would be glad if someone added a comment, if I got something wrong.
In order for the mail response to be sent to ASP.net and the OnClick control to be OnClick , when event checking is enabled, the client must send the __EVENTVALIDATION form __EVENTVALIDATION . This field contains a unique string that basically tells ASP.net which controls the postback event for this page that may have originated from. If you try to fake a .Visibility = false for the button on which .Visibility = false , you will see an error message checking events. So it seems like you cannot directly spoof a click on a hidden control.
How about replacing the postback of one of the existing buttons on the page that you selected (i.e. you have permission to view / click on it)? Well, you can send a back link to the page, but you need to send a valid __VIEWSTATE or you just get a "status information" error. To have a valid __VIEWSTATE , you already need to load the page as unsent, right? This means that the security check code will be executed at least once, hiding the corresponding controls and writing them to __VIEWSTATE . That way, when you send the spoof postback, yes, it will cause the Page.IsPostBack value Page.IsPostBack be true, but it doesnโt matter since the __VIEWSTATE presented __VIEWSTATE already generated at the previous load without postback to hide the content that you should not have access to ... so you can fool the __VIEWSTATE , but only by passing __VIEWSTATE , which was previously generated by loading without postback.
So, because of these facts, it should be safe only to put the security verification code inside the Page.IsPostBack == false block. This should always be run once before a valid postback can be sent to the ASP.net server. Or am I missing something?
Jez
source share