'Category'에 해당되는 글 74건

  1. 2014.04.09 shl 32bit
  2. 2012.01.19 네트워크기초 1
  3. 2011.09.27 Windows Internals 6
  4. 2011.05.28 flower
  5. 2011.05.17 __ClientLoadLibrary
  6. 2011.04.03 calling convetion확인
  7. 2011.04.02 튼실한 다리...
  8. 2011.03.27 분위기
  9. 2011.03.14 Windows7 x64 EPROCESS Structure offset...
  10. 2011.03.06 CodeGate 2011 예선 종료...

shl 32bit

Study/Reversing 2014. 4. 9. 23:03

mov eax, ffffffffh

shl eax, 20h

.

eax is ffffffffh...

Posted by hazeyun
,

네트워크기초 1

Study/Network 2012. 1. 19. 23:41
TCP/IP - Transmition Control Protocol / Internet Protocol

ethernet의 protocol인 CSMA/CD(Carrier Sensor Multiple Access / Collision Detect)
충돌이 있을 경우 특정 알고리즘에 의해 일정시간 후에 재시도 일정시간은 지속적으로 길어짐! 

UTP - Unshielded Twisted Pair
STP- Shielded Twisted Pair
1/2/3/6 번만 사용되어짐

DirectCable / CrossCable
PC <- DirectCable -> Switch
PC <- CrossCable -> PC
PC <- CrossCable -> Router

10 base T = 10Mbps이며 Baseband이고 TP케이블다.

Unicast - 대상이 한명(one)
Broadcast  - 해당 네트웍의 모든 대상(all)
Multicast - 해당 네트웍의 일부대상(some)

MAC(Media Access Control) 
총 48bit(6byte)로 이루어져 있으며 상위 28bit가 제조사 하위 28bit가 고유번호이다
Posted by hazeyun
,

Windows Internals 6

idle talk 2011. 9. 27. 10:01


아마존(www.amazon.com)에 얼마전 검색하는데 Windows Internals 6판이 올라와있내요...

날짜를 보니 12월 22일 나오는걸 예판하는듯...^^

5판도 덜 봤는데;; ㅋ
Posted by hazeyun
,

flower

Snap 2011. 5. 28. 19:45


Posted by hazeyun
,

KernelCallbackTable에 존재하는 __ClientLoadLibrary의 경우
SetWindowsHookEx를 이용한 dll injection시 호출되어지고
내부에서 LoadLibraryExW를 호출하여 dll를 로드하게 되어있다.

SetWindowsHookEx를 통한 dll인젝션 차단의 경우 LoadLibraryExW를 모니터링 하여
user32에서 호출되었는지 확인하는 것으로 차단할 수 있다고
많은 블로그들에 나와있는 이유가 여기에 있다.

Posted by hazeyun
,

C++의 함수 호출 형태를 보면 3가지(_cdecl / _stdcall / _fastcall)가 있는것을 알것이다.
3가지를 간략히 정리해 보면
1. _cdecl
    - 파라미터 전달은 오른쪽에서 왼쪽 방향으로 스택을 이용
    - 파라미터 해제는 호출한 함수가 정리(그러므로 가변인자가 가능)
2. _stdcall
    - 파라미터 전달은 오른쪽에서 왼쪽 방향으로 스택을 이용
    - 파라미터 해제는 불려진 함수 내에서 정리
3. _fastcall
    - 처음 두개를 레지스터(ecx, edx)를 이용하고 나머지 파라미터를 오른쪼에서 왼쪽으로 스택을 이용
    - 파라미터 해제는 불려진 함수 내에서 정리
위와 같이 정리해 볼수 있다.

그럼 int sum(int a, int b)함수를 3가지로 구현해서 직접 확인해 보자.
첫번째로 아래 코드는 RETN시 스택을 정리 해주기 위한 부분이 없다. 이를 통해서 _cdecl을 이용해 구현한 함수 임을 파악해 볼 수 있다.


다음 코드를 보면 RETN 8을 통해 스택을 정리 해주는 것을 알 수 있다. 또한 ecx, edx를 사용하지 않았으므로 이는 _stdcall을 통해서 구현한 함수 임을 파악이 가능하다.

마지막으로 아래 코드를 보면 ECX와 EDX를 이용하 였다는 것을 알 수 있다. 하지만 _fastcall의 경우 불려진 함수 내에서 스택을 정리한다고 되어있는데 RETN시 스택을 정리 하는 부분이 없어 의아해 할 수 있다. 이는 ECX와 EDX레지스트만 이용하였기 때문에 스택을 정리 해줄 필요가 없기 때문이다. 아래의 함수는 _fastcall임을 알 수 있다.

위와같이 calling convetion을 이해하고 어셈코드의 구조를 파악하고 있다면 리버싱 단계에서 해당 함수의 calling convetion을 파악하고 코드화 하는데 휠씬 도움이 될것 이다.

Posted by hazeyun
,

튼실한 다리...

Snap 2011. 4. 2. 23:17

 

Posted by hazeyun
,

분위기

Snap 2011. 3. 27. 17:17


Posted by hazeyun
,

nt!_EPROCESS
   +0x000 Pcb              : _KPROCESS
   +0x160 ProcessLock      : _EX_PUSH_LOCK
   +0x168 CreateTime       : _LARGE_INTEGER
   +0x170 ExitTime         : _LARGE_INTEGER
   +0x178 RundownProtect   : _EX_RUNDOWN_REF
   +0x180 UniqueProcessId  : Ptr64 Void
   +0x188 ActiveProcessLinks : _LIST_ENTRY
   +0x198 ProcessQuotaUsage : [2] Uint8B
   +0x1a8 ProcessQuotaPeak : [2] Uint8B
   +0x1b8 CommitCharge     : Uint8B
   +0x1c0 QuotaBlock       : Ptr64 _EPROCESS_QUOTA_BLOCK
   +0x1c8 CpuQuotaBlock    : Ptr64 _PS_CPU_QUOTA_BLOCK
   +0x1d0 PeakVirtualSize  : Uint8B
   +0x1d8 VirtualSize      : Uint8B
   +0x1e0 SessionProcessLinks : _LIST_ENTRY
   +0x1f0 DebugPort        : Ptr64 Void
   +0x1f8 ExceptionPortData : Ptr64 Void
   +0x1f8 ExceptionPortValue : Uint8B
   +0x1f8 ExceptionPortState : Pos 0, 3 Bits
   +0x200 ObjectTable      : Ptr64 _HANDLE_TABLE
   +0x208 Token            : _EX_FAST_REF
   +0x210 WorkingSetPage   : Uint8B
   +0x218 AddressCreationLock : _EX_PUSH_LOCK
   +0x220 RotateInProgress : Ptr64 _ETHREAD
   +0x228 ForkInProgress   : Ptr64 _ETHREAD
   +0x230 HardwareTrigger  : Uint8B
   +0x238 PhysicalVadRoot  : Ptr64 _MM_AVL_TABLE
   +0x240 CloneRoot        : Ptr64 Void
   +0x248 NumberOfPrivatePages : Uint8B
   +0x250 NumberOfLockedPages : Uint8B
   +0x258 Win32Process     : Ptr64 Void
   +0x260 Job              : Ptr64 _EJOB
   +0x268 SectionObject    : Ptr64 Void
   +0x270 SectionBaseAddress : Ptr64 Void
   +0x278 Cookie           : Uint4B
   +0x27c UmsScheduledThreads : Uint4B
   +0x280 WorkingSetWatch  : Ptr64 _PAGEFAULT_HISTORY
   +0x288 Win32WindowStation : Ptr64 Void
   +0x290 InheritedFromUniqueProcessId : Ptr64 Void
   +0x298 LdtInformation   : Ptr64 Void
   +0x2a0 Spare            : Ptr64 Void
   +0x2a8 ConsoleHostProcess : Uint8B
   +0x2b0 DeviceMap        : Ptr64 Void
   +0x2b8 EtwDataSource    : Ptr64 Void
   +0x2c0 FreeTebHint      : Ptr64 Void
   +0x2c8 FreeUmsTebHint   : Ptr64 Void
   +0x2d0 PageDirectoryPte : _HARDWARE_PTE
   +0x2d0 Filler           : Uint8B
   +0x2d8 Session          : Ptr64 Void
   +0x2e0 ImageFileName    : [15] UChar
   +0x2ef PriorityClass    : UChar
   +0x2f0 JobLinks         : _LIST_ENTRY
   +0x300 LockedPagesList  : Ptr64 Void
   +0x308 ThreadListHead   : _LIST_ENTRY
   +0x318 SecurityPort     : Ptr64 Void
   +0x320 Wow64Process     : Ptr64 Void
   +0x328 ActiveThreads    : Uint4B
   +0x32c ImagePathHash    : Uint4B
   +0x330 DefaultHardErrorProcessing : Uint4B
   +0x334 LastThreadExitStatus : Int4B
   +0x338 Peb              : Ptr64 _PEB
   +0x340 PrefetchTrace    : _EX_FAST_REF
   +0x348 ReadOperationCount : _LARGE_INTEGER
   +0x350 WriteOperationCount : _LARGE_INTEGER
   +0x358 OtherOperationCount : _LARGE_INTEGER
   +0x360 ReadTransferCount : _LARGE_INTEGER
   +0x368 WriteTransferCount : _LARGE_INTEGER
   +0x370 OtherTransferCount : _LARGE_INTEGER
   +0x378 CommitChargeLimit : Uint8B
   +0x380 CommitChargePeak : Uint8B
   +0x388 AweInfo          : Ptr64 Void
   +0x390 SeAuditProcessCreationInfo : _SE_AUDIT_PROCESS_CREATION_INFO
   +0x398 Vm               : _MMSUPPORT
   +0x420 MmProcessLinks   : _LIST_ENTRY
   +0x430 HighestUserAddress : Ptr64 Void
   +0x438 ModifiedPageCount : Uint4B
   +0x43c Flags2           : Uint4B
   +0x43c JobNotReallyActive : Pos 0, 1 Bit
   +0x43c AccountingFolded : Pos 1, 1 Bit
   +0x43c NewProcessReported : Pos 2, 1 Bit
   +0x43c ExitProcessReported : Pos 3, 1 Bit
   +0x43c ReportCommitChanges : Pos 4, 1 Bit
   +0x43c LastReportMemory : Pos 5, 1 Bit
   +0x43c ReportPhysicalPageChanges : Pos 6, 1 Bit
   +0x43c HandleTableRundown : Pos 7, 1 Bit
   +0x43c NeedsHandleRundown : Pos 8, 1 Bit
   +0x43c RefTraceEnabled  : Pos 9, 1 Bit
   +0x43c NumaAware        : Pos 10, 1 Bit
   +0x43c ProtectedProcess : Pos 11, 1 Bit
   +0x43c DefaultPagePriority : Pos 12, 3 Bits
   +0x43c PrimaryTokenFrozen : Pos 15, 1 Bit
   +0x43c ProcessVerifierTarget : Pos 16, 1 Bit
   +0x43c StackRandomizationDisabled : Pos 17, 1 Bit
   +0x43c AffinityPermanent : Pos 18, 1 Bit
   +0x43c AffinityUpdateEnable : Pos 19, 1 Bit
   +0x43c PropagateNode    : Pos 20, 1 Bit
   +0x43c ExplicitAffinity : Pos 21, 1 Bit
   +0x440 Flags            : Uint4B
   +0x440 CreateReported   : Pos 0, 1 Bit
   +0x440 NoDebugInherit   : Pos 1, 1 Bit
   +0x440 ProcessExiting   : Pos 2, 1 Bit
   +0x440 ProcessDelete    : Pos 3, 1 Bit
   +0x440 Wow64SplitPages  : Pos 4, 1 Bit
   +0x440 VmDeleted        : Pos 5, 1 Bit
   +0x440 OutswapEnabled   : Pos 6, 1 Bit
   +0x440 Outswapped       : Pos 7, 1 Bit
   +0x440 ForkFailed       : Pos 8, 1 Bit
   +0x440 Wow64VaSpace4Gb  : Pos 9, 1 Bit
   +0x440 AddressSpaceInitialized : Pos 10, 2 Bits
   +0x440 SetTimerResolution : Pos 12, 1 Bit
   +0x440 BreakOnTermination : Pos 13, 1 Bit
   +0x440 DeprioritizeViews : Pos 14, 1 Bit
   +0x440 WriteWatch       : Pos 15, 1 Bit
   +0x440 ProcessInSession : Pos 16, 1 Bit
   +0x440 OverrideAddressSpace : Pos 17, 1 Bit
   +0x440 HasAddressSpace  : Pos 18, 1 Bit
   +0x440 LaunchPrefetched : Pos 19, 1 Bit
   +0x440 InjectInpageErrors : Pos 20, 1 Bit
   +0x440 VmTopDown        : Pos 21, 1 Bit
   +0x440 ImageNotifyDone  : Pos 22, 1 Bit
   +0x440 PdeUpdateNeeded  : Pos 23, 1 Bit
   +0x440 VdmAllowed       : Pos 24, 1 Bit
   +0x440 CrossSessionCreate : Pos 25, 1 Bit
   +0x440 ProcessInserted  : Pos 26, 1 Bit
   +0x440 DefaultIoPriority : Pos 27, 3 Bits
   +0x440 ProcessSelfDelete : Pos 30, 1 Bit
   +0x440 SetTimerResolutionLink : Pos 31, 1 Bit
   +0x444 ExitStatus       : Int4B
   +0x448 VadRoot          : _MM_AVL_TABLE
   +0x488 AlpcContext      : _ALPC_PROCESS_CONTEXT
   +0x4a8 TimerResolutionLink : _LIST_ENTRY
   +0x4b8 RequestedTimerResolution : Uint4B
   +0x4bc ActiveThreadsHighWatermark : Uint4B
   +0x4c0 SmallestTimerResolution : Uint4B
   +0x4c8 TimerResolutionStackRecord : Ptr64 _PO_DIAG_STACK_RECORD
Posted by hazeyun
,

전세계 해커들을 위한(?)해킹 방어대회 CodeGate 2011이 예선전을 마치고
본선을 앞두고 있다.

예선전의 경우 온라인으로 진행되어 자유롭게 참가가 가능했다.
많은 팀들이 참가 했고 나도 물론 참가신청을 했다. 뭐 문제는 거의 풀지 못했지만...
CodeGate에 대한건 많이 들어 봤지만 실제로 참가를 해본건 처음이다.
문제종류는 다양했고 창의적인 생각이 필요했다.
그리고 현재 내가 하고 있는 일과는 크게 연결되는 부분이 많지는 않았다.
하지만 앞으로 다른 분야에 대해서도 공부를 해봐야 겠다는걸 느낄수 있었다.
대표 적으로 forensic, webhacking, cryptology등이다.

일본팀이 1위를 했고 한국팀이 3팀이나 본선에 진출했다. 참고로 본선 진출은 8등까지다.
아래 사이트에 접속하면 예선전에 팀 순위에 대해서 알수 있다.
http://yut.codegate.org

Posted by hazeyun
,