Detection stack
- AIDR
- Alert
- ETL
- Query
요약
이 글은 Impacket 도구에 의해 생성된 LDAP 필터가 Active Directory에 의해 어떻게 일관되지 않은 공백을 도입하는 방식으로 정규화되는지를 설명합니다. 이벤트 ID 1644 로그. 이러한 형식 변경은 기본 필터 논리가 동일하더라도 정확한 문자열 매칭에 의존하는 탐지를 깨뜨릴 수 있습니다. 저자는 기본 “포함” 논리가 얼마나 취약한지를 보여주고, 공백 차이, 대소문자의 변화 및 연산자 변동을 허용하는 정규 표현식을 사용하여 견고한 시그마 탐지를 구축하는 과정을 안내합니다.
조사
문제를 검증하기 위해, 저자는 운영 중인 실제 이벤트 1644 기록을 검토하고 동일한 비트 연산 LDAP 필터의 여러 공백 조합(예: 다른 공백, 괄호 배치 및 형식을 가진 userAccountControl&524288의 변형)을 문서화했습니다. 여러 탐지 접근 방식이 시도되었으며, 정적 문자열 검사를 시작으로 점점 더 유연한 정규식 패턴으로 발전하여, 모든 관측된 표현을 과발화 없이 일관되게 일치시키는 규칙을 구현했습니다.
완화
선택적 공백을 허용하고, 대소문자 구분 없는 매칭을 지원하며, AND/OR 연산자 스타일을 고려하는 정규식 기반의 탐지를 채택하세요. 성능을 적정하게 유지하기 위해, 더 비용이 많이 드는 정규식 논리를 적용하기 전에 대상 속성 이름에서 사전 필터링을 수행하세요. 마지막으로, 현장에서 목격된 모든 공백 및 형식 변형을 포착한 엄선된 ‘부끄러움의 벽’ 본문과 탐지를 지속적으로 검증하세요.
대응
의심스러운 LDAP 필터 매칭이 트리거되면, SOC에 통지하여 잠재적인 권한-탐색 또는 권한 상승 관련 열거 활동을 평가하도록 하세요. 의도를 파악하고 범위를 결정하기 위해 이벤트를 소스 호스트/IP, 요청 사용자 및 기타 LDAP 속성과 연결하세요. 오탐이 발생할 경우, 이미 알려진 형식 변형에 대한 커버리지를 유지하면서 임계값과 규칙 조건을 조정하세요.
공격 흐름
이 부분을 아직 업데이트 중입니다. 알림을 받으려면 가입하세요.
알림 설정시뮬레이션 실행
전제 조건: Telemetry & Baseline 사전 점검이 통과해야 합니다.
논리: 이 섹션은 탐지 규칙을 트리거하기 위해 설계된 공격자 기술(TTP)의 정밀한 실행을 상세히 설명합니다. 명령과 설명은 식별된 TTP를 직접 반영하고, 탐지 논리가 예상하는 정확한 원격 측정을 생성해야 합니다.
-
공격 내러티브 및 명령:
낮은 권한의 도메인 자격 증명을 가진 공격자가 측면 이동을 위한 권한 계정을 찾고자 합니다. 그들은userAccountControl을 비트 연산 AND하여관리자플래그(값 524288)를 가진 계정을 격리하는 LDAP 필터를 작성합니다. 간단한 문자열 매칭을 피하기 위해, 그들은 Sigma 규칙이 예상하는 대로 정확히 여분의 공백과 괄호를 추가합니다.- 공백 변형을 사용하여 LDAP 필터 문자열을 만듭니다.
- 도메인 컨트롤러에 대해
ldapsearch(PowerShell 통해)를 사용하여 LDAP 검색을 실행하세요. - 보안 이벤트 로그가 작성한 필터를 포함하는 이벤트 1644를 기록하고 있는지 확인합니다.
-
회귀 테스트 스크립트:
# -------------------------------------------------------------- # Sigma 규칙을 트리거해야 하는 LDAP 비트 연산 필터 시뮬레이션 # -------------------------------------------------------------- # 매개 변수 $DomainController = "dc01.example.com" $BaseDN = "DC=example,DC=com" $Filter = "( userAccountControl & 524288 )" $Attributes = "distinguishedName,samAccountName,userAccountControl" # LDAP 쿼리 실행 try { $result = [ADSI]"LDAP://$DomainController/$BaseDN" $searcher = New-Object System.DirectoryServices.DirectorySearcher($result) $searcher.Filter = $Filter $searcher.PropertiesToLoad.AddRange($Attributes.Split(',')) $searcher.PageSize = 1000 $entries = $searcher.FindAll() foreach ($entry in $entries) { $dn = $entry.Properties["distinguishedname"][0] $sam = $entry.Properties["samaccountname"][0] $uac = $entry.Properties["useraccountcontrol"][0] Write-Output "Found: $sam ($dn) – UAC=$uac" } } catch { Write-Error "LDAP 쿼리 실패: $_" } -
정리 명령:
# 지속적인 변경은 없었습니다; ADSI 연결만 닫으세요. Write-Output "정리 완료."
SOC Prime의 Detection as Code 플랫폼에 가입하세요 귀사의 비즈니스에 가장 중요한 위협에 대한 가시성을 개선하세요. 시작을 돕고 즉각적인 가치를 제공하기 위해 지금 SOC Prime 전문가와의 회의를 예약하세요.
Cookie Settings
You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
| Name | Descripiton |
|---|---|
| PHPSESSID | Preserves user session state across page requests. Cookie generated by applications based on the PHP language. This is a general purpose identifier used to maintain user session variables. It is normally a random generated number, how it is used can be specific to the site, but a good example is maintaining a logged-in status for a user between pages. |
| sp_i | Used to store information about authenticated User. |
| sp_r | Used to store information about authenticated User. |
| sp_a | Used to store information about authenticated User. |
All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
| Name | Descripiton |
|---|---|
| tuuid | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded. |
| tuuid_last_update | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded. |
| um | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded. |
| umeh | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded. |
| na_sc_x | Used by the social sharing platform AddThis to keep a record of parts of the site that has been visited in order to recommend other parts of the site. |
| APID | Collects anonymous data related to the user's visits to the website. |
| IDSYNC | Collects anonymous data related to the user's visits to the website. |
| _cc_aud | Collects anonymous statistical data related to the user's website visits, such as the number of visits, average time spent on the website and what pages have been loaded. The purpose is to segment the website's users according to factors such as demographics and geographical location, in order to enable media and marketing agencies to structure and understand their target groups to enable customised online advertising. |
| _cc_cc | Collects anonymous statistical data related to the user's website visits, such as the number of visits, average time spent on the website and what pages have been loaded. The purpose is to segment the website's users according to factors such as demographics and geographical location, in order to enable media and marketing agencies to structure and understand their target groups to enable customised online advertising. |
| _cc_dc | Collects anonymous statistical data related to the user's website visits, such as the number of visits, average time spent on the website and what pages have been loaded. The purpose is to segment the website's users according to factors such as demographics and geographical location, in order to enable media and marketing agencies to structure and understand their target groups to enable customised online advertising. |
| _cc_id | Collects anonymous statistical data related to the user's website visits, such as the number of visits, average time spent on the website and what pages have been loaded. The purpose is to segment the website's users according to factors such as demographics and geographical location, in order to enable media and marketing agencies to structure and understand their target groups to enable customised online advertising. |
| dpm | Via a unique ID that is used for semantic content analysis, the user's navigation on the website is registered and linked to offline data from surveys and similar registrations to display targeted ads. |
| acs | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded, with the purpose of displaying targeted ads. |
| clid | Collects anonymous data related to the user's visits to the website, such as the number of visits, average time spent on the website and what pages have been loaded, with the purpose of displaying targeted ads. |
| KRTBCOOKIE_# | Registers a unique ID that identifies the user's device during return visits across websites that use the same ad network. The ID is used to allow targeted ads. |
| PUBMDCID | Registers a unique ID that identifies the user's device during return visits across websites that use the same ad network. The ID is used to allow targeted ads. |
| PugT | Registers a unique ID that identifies the user's device during return visits across websites that use the same ad network. The ID is used to allow targeted ads. |
| ssi | Registers a unique ID that identifies a returning user's device. The ID is used for targeted ads. |
| _tmid | Registers a unique ID that identifies the user's device upon return visits. The ID is used to target ads in video clips. |
| wam-sync | Used by the advertising platform Weborama to determine the visitor's interests based on pages visits, content clicked and other actions on the website. |
| wui | Used by the advertising platform Weborama to determine the visitor's interests based on pages visits, content clicked and other actions on the website. |
| AFFICHE_W | Used by the advertising platform Weborama to determine the visitor's interests based on pages visits, content clicked and other actions on the website. |
| B | Collects anonymous data related to the user's website visits, such as the number of visits, average time spent on the website and what pages have been loaded. The registered data is used to categorise the users' interest and demographical profiles with the purpose of customising the website content depending on the visitor. |
| 1P_JAR | These cookies are used to gather website statistics, and track conversion rates. |
| APISID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| HSID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| NID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| SAPISID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| SID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| SIDCC | Security cookie to protect users data from unauthorised access. |
| SSID | Google set a number of cookies on any page that includes a Google reCAPTCHA. While we have no control over the cookies set by Google, they appear to include a mixture of pieces of information to measure the number and behaviour of Google reCAPTCHA users. |
| __utmx | This cookie is associated with Google Website Optimizer, a tool designed to help site owners improve their wbesites. It is used to distinguish between two varaitions a webpage that might be shown to a visitor as part of an A/B split test. This helps site owners to detemine which version of a page performs better, and therefore helps to improve the website. |
| __utmxx | This cookie is associated with Google Website Optimizer, a tool designed to help site owners improve their wbesites. It is used to distinguish between two varaitions a webpage that might be shown to a visitor as part of an A/B split test. This helps site owners to detemine which version of a page performs better, and therefore helps to improve the website. |
If you do not allow these cookies then some or all of these services may not function properly.
| Name | Descripiton |
|---|---|
| _hjid | Hotjar cookie. This cookie is set when the customer first lands on a page with the Hotjar script. It is used to persist the random user ID, unique to that site on the browser. This ensures that behavior in subsequent visits to the same site will be attributed to the same user ID. |
| _hjIncludedInSample | This cookie is associated with web analytics functionality and services from Hot Jar, a Malta based company. It uniquely identifies a visitor during a single browser session and indicates they are included in an audience sample. |
| intercom-id-[xxx] | This cookie is used by Intercom as a session so that users can continue a chat as they move through the site. |
| intercom-session-[xxx] | Used to keeping track of sessions and remember logins and conversations. |
| demdex | Via a unique ID that is used for semantic content analysis, the user's navigation on the website is registered and linked to offline data from surveys and similar registrations to display targeted ads. |
| CookieConsent | Stores the user's cookie consent state for the current domain. |
| __cfduid | Used by the content network, Cloudflare, to identify trusted web traffic. |
| ss | These cookies enable the website to provide enhanced functionality and
personalisation . They may be set by us or by third party providers whose
services we have added to our pages. These services may include the Live Chat facility, Contact Us form(s), the Product Quotation forms and submission process, and the Email Newsletter sign up functionality . |
They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.
| Name | Descripiton |
|---|---|
| _ga | This cookie name is asssociated with Google Universal Analytics - which is a significant update to Google's more commonly used analytics service. This cookie is used to distinguish unique users by assigning a randomly generated number as a client identifier. It is included in each page. Registers a unique ID that is used to generate statistical data on how the visitor uses the website. request in a site and used to calculate visitor, session and campaign data for the sites analytics reports. By default it is set to expire after 2 years, although this is customisable by website owners. |
| _gat | Used by Google Analytics to throttle request rate. This cookie name is associated with Google Universal Analytics, according to documentation it is used to throttle the request rate - limiting the collection of data on high traffic sites. It expires after 10 minutes. |
| _gid | This cookie name is asssociated with Google Universal Analytics. This appears to be a new cookie and as of Spring 2017 no information is available from Google. It appears to store and update a unique value for each page visited. Registers a unique ID that is used to generate statistical data on how the visitor uses the website. |
| IDE | Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user. |
| r/collect | Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user. |
| test_cookie | Used to check if the user's browser supports cookies. |
| collect | Used to send data to Google Analytics about the visitor's device and behaviour. Tracks the visitor across devices and marketing channels. |
| ads/user-lists/# | These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. |
| c | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |
| khaos | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |
| put_# | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |
| rpb | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |
| rpx | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |
| tap.php | Registers anonymised user data, such as IP address, geographical location, visited websites, and what ads the user has clicked, with the purpose of optimising ad display based on the user's movement on websites that use the same ad network. |