Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

ActiveX 없는 전자 메일에 사용된 "개인정보 보호를 위해 암호화된 보안메일"의 문제점

예전에는, 전자 메일에 아래와 같은 식의 보안이 필요한 HTML 파일이 첨부된 경우,

secure_mail_1.png

보통은 Internet Explorer로만 열어야 했습니다. 왜냐하면, 복호화를 위해 ActiveX를 사용했기 때문인데, 어느 순간부터 해당 HTML 파일이 "Edge"나 "Chrome" 웹 브라우저에서도 잘 열리는 것이었습니다.

이상하군요... 음... 제가 개발자이다 보니 ^^ HTML 문서만으로 암호화/복호화를 구현하는 것이 쉽지 않다는 것을 알고 있기 때문에 혹시나 하는 마음으로 해당 HTML 파일을 살펴봤습니다.

역시나, 복호화 코드는 매우 간단했습니다. 다음과 같이 키값이 인코딩되어 문자열로 HTML 문서에 포함되어 있었고,

"\x31\x35\x37\x32\x38\x36\x34\x30\x30"

사용자가 HTML Form에 입력한 값을 다음과 같이 비교하는 것이 전부였습니다.

if (Math.abs(pwd << pwd) != unescape('\x31\x35\x37\x32\x38\x36\x34\x30\x30'))
{
    alert('비밀번호가 일치하지 않습니다.');
    document.frm.pwd.value = '';
    document.frm.pwd.focus();
    return;
}

그러니까, 사용자가 "690101"이라고 생년월일을 입력했다면 그 자체를 숫자로 취급해 다음과 같이 shift 연산을 한 다음,

var shiftedValue = 690101 << 690101;

그 결과에 절댓값만 취한 후 HTML에 포함되어 있던 인코딩 문자열("\x31\x35\x37\x32\x38\x36\x34\x30\x30")과 비교하는 것으로 사용자 인증이 이뤄집니다.

Math.abs(shiftedValue) != unescape('\x31\x35\x37\x32\x38\x36\x34\x30\x30')

따라서, "개인정보 보호를 위해 암호화된 보안메일"이라고 되어 있는 그 HTML 파일만 입수한다면, 그 주인이 누구인지에 상관없이 다음과 같이 쉽게 brute force 방식의 코드를 만들어 키를 알아낼 수 있습니다. (또는, 보안 HTML 파일 내의 javascript에 적절하게 loop만 돌려주어도 됩니다.)

using System;
using System.Web;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string encrypted = "\x31\x35\x37\x32\x38\x36\x34\x30\x30";

            string expected = HttpUtility.UrlDecode(encrypted);

            DateTime now = DateTime.Now;

            // 나이가 대충 100살 이내라고 가정하고,
            DateTime candidate = new DateTime(now.Year - 100, now.Month, now.Day, 0, 0, 1);

            for (int i = 1; i <= 100 * 12 * 31; i++)
            {
                candidate = candidate.AddDays(1);
                string result = candidate.ToString("yyMMdd");

                int value = Int32.Parse(result);
                long shifted = (value << value);

                string key = ((int)Math.Abs(shifted)).ToString();

                if (key == expected)
                {
                    Console.WriteLine("Your key is " + result);
                }
            }
        }
    }
}




사실, 너무나 쉽게 풀리는 암호화라는 측면에서 이 정도면 거의 "인코딩"에 가까운 보안 수준입니다. 그렇긴 한데, 참 쉽지 않은 문제 같습니다. ActiveX를 사용하자니 플랫폼 제약이 생기고, 쓰지 않자니 저렇게 허술한 "암호화된 보안메일"로 구현이 되고!!!

그나저나, 조금 찾아보니 괜찮아 보이는 메일 암호화 제품들이 나오고 있는 것 같습니다.

Unisafe Mail - Non-ActiveX 방식의 메일 암호화 솔루션
; http://www.unisecure.co.kr/sub02.html

저 제품의 경우, 암호화 알고리즘만큼은 최소한 AES, SHA-256 등의 단어를 쓰는 걸로 봐서 구색은 갖춘 것 같습니다. 게다가 "시간당 50만 건 처리"와 같은 문구를 보니 서버로의 연결을 필요로 하는 것 같은데 HTML 내에 코드를 포함하는 형식이 아닌 듯하므로 좀 더 안전해 보입니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 5/25/2017]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 61  62  63  64  65  66  67  68  69  [70]  71  72  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
11882정성태5/2/201914055.NET Framework: 826. (번역글) .NET Internals Cookbook Part 11 - Various C# riddles파일 다운로드1
11881정성태4/28/201914342오류 유형: 532. .NET Core 프로젝트로 마이그레이션 시 "CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute" 오류 발생
11880정성태4/25/201911092오류 유형: 531. 이벤트 로그 오류 - Task Scheduling Error: m->NextScheduledSPRetry 1547, m->NextScheduledEvent 1547
11879정성태4/24/201916350.NET Framework: 825. (번역글) .NET Internals Cookbook Part 10 - Threads, Tasks, asynchronous code and others파일 다운로드2
11878정성태4/22/201914319.NET Framework: 824. (번역글) .NET Internals Cookbook Part 9 - Finalizers, queues, card tables and other GC stuff파일 다운로드1
11877정성태4/22/201914199.NET Framework: 823. (번역글) .NET Internals Cookbook Part 8 - C# gotchas파일 다운로드1
11876정성태4/21/201914035.NET Framework: 822. (번역글) .NET Internals Cookbook Part 7 - Word tearing, locking and others파일 다운로드1
11875정성태4/21/201914408오류 유형: 530. Visual Studo에서 .NET Core 프로젝트를 열 때 "One or more errors occurred." 오류 발생
11874정성태4/20/201914414.NET Framework: 821. (번역글) .NET Internals Cookbook Part 6 - Object internals파일 다운로드1
11873정성태4/19/201913376.NET Framework: 820. (번역글) .NET Internals Cookbook Part 5 - Methods, parameters, modifiers파일 다운로드1
11872정성태4/17/201913859.NET Framework: 819. (번역글) .NET Internals Cookbook Part 4 - Type members파일 다운로드1
11871정성태4/16/201913673.NET Framework: 818. (번역글) .NET Internals Cookbook Part 3 - Initialization tricks [3]파일 다운로드1
11870정성태4/16/201911426.NET Framework: 817. Process.Start로 실행한 콘솔 프로그램의 출력 결과를 얻는 방법파일 다운로드1
11869정성태4/15/201915192.NET Framework: 816. (번역글) .NET Internals Cookbook Part 2 - GC-related things [2]파일 다운로드2
11868정성태4/15/201912929.NET Framework: 815. CER(Constrained Execution Region)이란?파일 다운로드1
11867정성태4/15/201911926.NET Framework: 814. Critical Finalizer와 SafeHandle의 사용 의미파일 다운로드1
11866정성태4/9/201915515Windows: 159. 네트워크 공유 폴더(net use)에 대한 인증 정보는 언제까지 유효할까요?
11865정성태4/9/201911234오류 유형: 529. 제어판 - C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools is not accessible.
11864정성태4/9/201910447오류 유형: 528. '...' could be '0': this does not adhere to the specification for the function '...'
11863정성태4/9/201910258디버깅 기술: 127. windbg - .NET x64 EXE의 EntryPoint
11862정성태4/7/201912306개발 환경 구성: 437. .NET EXE의 ASLR 기능을 끄는 방법
11861정성태4/6/201912085디버깅 기술: 126. windbg - .NET x86 CLR2/CLR4 EXE의 EntryPoint
11860정성태4/5/201915334오류 유형: 527. Visual C++ 컴파일 오류 - error C2220: warning treated as error - no 'object' file generated
11859정성태4/4/201912689디버깅 기술: 125. WinDbg로 EXE의 EntryPoint에서 BP 거는 방법
11858정성태3/27/201913146VC++: 129. EXE를 LoadLibrary로 로딩해 PE 헤더에 있는 EntryPoint를 직접 호출하는 방법파일 다운로드1
11857정성태3/26/201912077VC++: 128. strncpy 사용 시 주의 사항(Linux / Windows)
... 61  62  63  64  65  66  67  68  69  [70]  71  72  73  74  75  ...