# T1106 - Native API
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1106)
<blockquote>Adversaries may directly interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.(Citation: NT API Windows)(Citation: Linux Kernel API) These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.

Functionality provided by native APIs are often also exposed to user-mode applications via interfaces and libraries. For example, functions such as the Windows API <code>CreateProcess()</code> or GNU <code>fork()</code> will allow programs and scripts to start other processes.(Citation: Microsoft CreateProcess)(Citation: GNU Fork) This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.(Citation: Microsoft Win32)(Citation: LIBC)(Citation: GLIBC)

Higher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.(Citation: Microsoft NET)(Citation: Apple Core Services)(Citation: MACOS Cocoa)(Citation: macOS Foundation)

Adversaries may abuse these native API functions as a means of executing behaviors. Similar to [Command and Scripting Interpreter](https://attack.mitre.org/techniques/T1059), the native API and its hierarchy of interfaces, provide mechanisms to interact with and utilize various components of a victimized system.</blockquote>

## Atomic Tests

- [Atomic Test #1 - Execution through API - CreateProcess](#atomic-test-1---execution-through-api---createprocess)


<br/>

## Atomic Test #1 - Execution through API - CreateProcess
Execute program by leveraging Win32 API's. By default, this will launch calc.exe from the command prompt.

**Supported Platforms:** Windows


**auto_generated_guid:** 99be2089-c52d-4a4a-b5c3-261ee42c8b62





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| source_file | Location of the CSharp source file to compile and execute | Path | PathToAtomicsFolder&#92;T1106&#92;src&#92;CreateProcess.cs|
| output_file | Location of the payload | Path | %tmp%&#92;T1106.exe|


#### Attack Commands: Run with `command_prompt`! 


```cmd
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /out:"#{output_file}" /target:exe #{source_file}
%tmp%/T1106.exe
```






<br/>
