<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    如何消除VeraCode檢測(cè)中的CRLF Injection Issue(CWE ID 117)

    Veracode是一個(gè)檢測(cè)應(yīng)用程序是否存在安全漏洞的工具,更多細(xì)節(jié)請(qǐng)?jiān)L問http://www.veracode.com

    這里主要總結(jié)一下如何消除Veracode檢測(cè)結(jié)果中的CRLF(Carriage Return, Line Feed) Injection Issue(CWE ID 117)。

    首先,先看看VeraCode對(duì)CRLF Injection Issue的定義:
    The acronym CRLF stands for "Carriage Return, Line Feed" and refers to the sequence of characters used to denote the end of a line of text.  CRLF injection vulnerabilities occur when data enters an application from an untrusted source and is not properly validated before being used.  For example, if an attacker is able to inject a CRLF into a log file, he could append falsified log entries, thereby misleading administrators or cover traces of the attack.  If an attacker is able to inject CRLFs into an HTTP response header, he can use this ability to carry out other attacks such as cache poisoning.  CRLF vulnerabilities primarily affect data integrity.

    再看卡VeraCode對(duì)如何解決這個(gè)問題的建議:
    Apply robust input filtering for all user-supplied data, using centralized data validation routines when possible.  Use output filters to sanitize all output derived from user-supplied input, replacing non-alphanumeric characters with their HTML entity equivalents.

    舉例:
    log.debug("xxxxxxxxxxxxxx");
    //這里的xxxxx部分內(nèi)容可能是從環(huán)境變量或者外部獲取的,所以Veracode認(rèn)為存在CRLF的安全隱患。

    通過對(duì)現(xiàn)有系統(tǒng)的實(shí)踐證明,對(duì)于這類CRLF Injection Issue,消除時(shí)主要遵循以下原則:

    1)使用Character.isISOControl去除變量中的ctrl類控制符
    2) 驗(yàn)證后返回新的字符串變量

      
    public static final String removeControlCharacter(String input)
        {
            
    if (input == null)
            {
                
    return "";
            }
            StringBuilder sb 
    = new StringBuilder();
            
    for (int i=0; i<input.codePointCount(0, input.length()); i++)
            {
                
    int codePoint = input.codePointAt(i);
                
    if(!Character.isISOControl(codePoint))
                {
                    sb.appendCodePoint(codePoint);
                }
            }
            
    return sb.toString();
        }
        
    修改后如下所示:
    log.debug(FileUtil.removeControlCharacter("xxxxxxxxxxxxxx"));

    posted on 2011-09-06 10:49 想飛就飛 閱讀(2187) 評(píng)論(0)  編輯  收藏


    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     

    公告


    導(dǎo)航

    <2011年9月>
    28293031123
    45678910
    11121314151617
    18192021222324
    2526272829301
    2345678

    統(tǒng)計(jì)

    常用鏈接

    留言簿(13)

    我參與的團(tuán)隊(duì)

    隨筆分類(69)

    隨筆檔案(68)

    最新隨筆

    搜索

    積分與排名

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 一级人做人a爰免费视频| 亚洲黄色免费观看| 亚洲国产成人高清在线观看 | 国产啪亚洲国产精品无码| 可以免费观看的国产视频| 亚洲成人高清在线观看| 国产免费看插插插视频| 最近的2019免费中文字幕| 亚洲男女一区二区三区| 免费观看亚洲人成网站| 日韩在线不卡免费视频一区| 亚洲熟妇av午夜无码不卡| 亚洲中文字幕伊人久久无码| 4虎永免费最新永久免费地址| 国产精品亚洲专区一区| 中文字幕亚洲精品资源网| 国产又大又长又粗又硬的免费视频| 中文字幕a∨在线乱码免费看| 亚洲精品国产国语| 亚洲αv久久久噜噜噜噜噜| 性盈盈影院免费视频观看在线一区| aaa毛片免费观看| 亚洲女子高潮不断爆白浆| 亚洲AV无码乱码国产麻豆| 国产免费观看青青草原网站| 69影院毛片免费观看视频在线| 猫咪www免费人成网站| 亚洲手机中文字幕| 亚洲成av人影院| 亚洲国产av一区二区三区| 黄色成人网站免费无码av| 午夜老司机永久免费看片| 乱爱性全过程免费视频| 亚洲欧洲日韩国产一区二区三区| 亚洲成av人影院| 中文字幕无码精品亚洲资源网| 日韩免费视频观看| 67194熟妇在线永久免费观看 | 99久久精品免费精品国产| 一级毛片在线完整免费观看| 亚洲国产欧美国产综合一区|