Session 安全性:tcl中未更新会话标识符

Session 安全性:tcl中未更新会话标识符,session,tcl,session-cookies,owasp,project-open,Session,Tcl,Session Cookies,Owasp,Project Open,我正在开发开源应用程序,在扫描过程中,我发现了以下漏洞: [Medium] Session Identifier Not Updated Issue: 13800882 Severity: Medium URL: https://<server_name>/register/ Risk(s): It is possible to steal or manipulate customer session and cookies, which might be used to imper

我正在开发开源应用程序,在扫描过程中,我发现了以下漏洞:

[Medium] Session Identifier Not Updated
Issue: 13800882
Severity: Medium
URL: https://<server_name>/register/
Risk(s): It is possible to steal or manipulate customer session and cookies, which might be used to impersonate a legitimate user,allowing the hacker to view or alter user records, and to perform transactions as that user
Fix: Do not accept externally created session identifiers
[Medium]会话标识符未更新
发行:13800882
严重程度:中等
网址:https:///register/
风险:有可能窃取或操纵客户会话和cookie,这些会话和cookie可能被用来模拟合法用户,允许黑客查看或更改用户记录,并以该用户的身份执行交易
修复:不接受外部创建的会话标识符
虽然提到了修复,但这不足以让我完全理解它。请指导我如何删除此项。如果需要了解问题,请告诉我任何进一步的详细信息。 项目源代码在tcl中

我发现下面的代码也有同样的功能,但它是用java编写的

  public HttpSession changeSessionIdentifier(HttpServletRequest request) throws AuthenticationException {

     // get the current session
        HttpSession oldSession = request.getSession();

     // make a copy of the session content
        Map<String,Object> temp = new ConcurrentHashMap<String,Object>();
        Enumeration e = oldSession.getAttributeNames();
        while (e != null && e.hasMoreElements()) {
               String name = (String) e.nextElement();
               Object value = oldSession.getAttribute(name);
               temp.put(name, value);
        }

     // kill the old session and create a new one
        oldSession.invalidate();
        HttpSession newSession = request.getSession();
        User user = ESAPI.authenticator().getCurrentUser();
        user.addSession( newSession );
        user.removeSession( oldSession );

     // copy back the session content
        for (Map.Entry<String, Object> stringObjectEntry : temp.entrySet()){
             newSession.setAttribute(stringObjectEntry.getKey(),       stringObjectEntry.getValue());
         }
  return newSession;
公共HttpSessionChangeSessionIdentifier(HttpServletRequest请求)引发AuthenticationException{ //获取当前会话 HttpSession oldSession=request.getSession(); //制作会话内容的副本 Map temp=新的ConcurrentHashMap(); 枚举e=oldSession.getAttributeNames(); while(e!=null&&e.hasMoreElements()){ 字符串名称=(字符串)e.nextElement(); 对象值=oldSession.getAttribute(名称); 温度输入(名称、值); } //终止旧会话并创建新会话 oldSession.invalidate(); HttpSession newSession=request.getSession(); User User=ESAPI.authenticator().getCurrentUser(); user.addSession(newSession); 用户移除会话(旧会话); //复制回会话内容 对于(Map.Entry stringObjectEntry:temp.entrySet()){ setAttribute(stringObjectEntry.getKey(),stringObjectEntry.getValue()); } 返回新闻会话; }

另外,我是TCL的新手。
如果您需要任何进一步的解释,请告诉我。

OWASP报告所讨论的问题是无法迁移会话以使用新ID,从而使攻击者更容易发现该ID并重用它。针对这种情况的保护措施是不时地更改会话ID(不,我不知道多久更改一次!),而Java代码正是这样做的

会话被表示为存储在浏览器中的令牌,通常存储在cookie中(cookie就是这样设计的)。然后使用该令牌查找与会话对应的数据库记录,该记录保存会话中键/值映射的序列化。这是一个简单的机制,但非常强大。由于序列化等原因,用于执行所有这些操作的Java代码在幕后会相当复杂,但Tcl值(通常,并且总是用于内置类型)是自然可序列化的,因此在这方面问题应该小得多;将会话复制到新密钥可以在不必首先反序列化的情况下完成

执行此操作的确切代码取决于使用的框架。我不知道project open[使用了什么,所以这是我们现在可以讨论的范围。您需要与其他实际从事PO工作的人交谈



尽管如此,最好的方法是使提供给客户端的密钥不是主键,这样您就可以更改会话密钥而不必删除任何内容您将能够使事情顺利进行。不过,这是一种更复杂的方法;在您的环境中实施可能不太实际。

OpenACS 5.9中有一个解决扫描报告的修复程序。请参阅OpenACS.org上的以下讨论以供参考


您查看了Tcl服务器代码是如何将会话ID映射到数据库条目的吗?顺便说一句,我已经为]project open(项目开放)做了一个标记,以便可以更清楚地标记有关它的问题;“开源”这绝对不是正确的选项!@DonalFellows我找不到用于将会话ID映射到db条目的代码。谢谢您的帮助taging@Donal_fellos我还没有收到项目开放团队的回复。