Setting HTTPONLY for Classic Asp Session Cookie

后端 未结 7 1605
闹比i
闹比i 2020-12-08 10:06

Does anyone know exactly how to set HTTPONLY on classic ASP session cookies?

This is the final thing that\'s been flagged in a vulnerability scan and needs fixing AS

7条回答
  •  轮回少年
    2020-12-08 10:32

    This page has lots of information that's relevant to your problem.

    .NET 1.1 doesn't add HttpOnly because it hadn't been invented yet.

    If your app will run under .NET 2.0 (I moved several Classic ASP sites to 2.0 virtually unchanged) HttpOnly is set by default.

    If I read him right, you can get the Session cookie and append ; HttpOnly; to it. He gives a java example:

    String sessionid = request.getSession().getId();
    response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; HttpOnly");
    

    Lastly, he suggests:

    if code changes are infeasible, web application firewalls can be used to add HttpOnly to session cookies

    Edited to add: to those who think migrating to .NET (which can accommodate most Classic ASP code unchanged) is too drastic a change to get such a small feature, my experience of ISAPI filters is that they, too, can be a major pain, and in some common situations (shared hosting) you can't use them at all.

提交回复
热议问题