반응형

IE(Internet Explorer)에서 메모리 덤프 패스워드 노출 방지

onsubmit함수를 통해서 패스워드를 주기적으로 초기화시

메모리덤프에 평문이 노출되는 것을 방지 가능하다.

하지만 chrome에서는 ...

<form id="loginForm" action="./index2.php" method="post" onsubmit="pwd_handler(this);">
    <input type="text" name="username" />
    <input type="password" name="password" autocomplete="off"/>
    <input type="hidden" name="md5password" value="" />
    <button onclick="fn_submit()">LOGIN</button>
</form>

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//cdn.rawgit.com/placemarker/jQuery-MD5/master/jquery.md5.js"></script>
<script type="text/javascript">
function pwd_handler(form)
{
        if (form.password.value != '')
        {
            form.md5password.value = $.md5(form.password.value);
            form.password.value = '';
        }
}

function fn_submit(){
    $.ajaxSetup({cache: false});
    document.getElementById('loginForm').submit();
}
</script>

[참고사이트]

https://resources.infosecinstitute.com/topic/browser-based-vulnerabilities-in-web-applications/#gref

https://stackoverflow.com/questions/23451956/how-do-i-encrypt-md5-text-input-before-sending-information-via-get

728x90
반응형

[javascript] input태그 자동 대문자 변환시키기

특정 input태그에 알파벳을 들어갈때 무조건 대문자로 들어 가야하는 경우가 있다. 이럴 경우 javascript의 bind함수를 이용하여 이벤트를 걸 수 있다. bind함수 속성에 keyup 속성을 이용하여 사용자가 알파벳을 입력하면(키보드를 누른 후) 해당 엘리먼트의 값이 동적으로 대문자로 변경하도록 로직을 쓰면 된다.

엘리먼트가 지속적으로 데이터를 확인해야하기 때문에 $(document).ready()안에 정의를 해야한다.

$(document).ready(function(){
   
   $('#element_id').bind("keyup", function(){
       $(this).val($(this).val().toUpperCase());
  });
   
});


728x90

+ Recent posts