0x00前言 Delegation是一套难度为中等的靶场环境,完成该挑战可以帮助玩家了解内网渗透中的代理转发、内网扫描、信息收集、特权提升以及横向移动技术方法,加强对域环境核心认证机制的理解,以及掌握域环境渗透中一些有趣的技术要点
toc Delegation委托是Apple iOS开发中很常见的一种模式,不过在之前开发Hipo中更多算是照猫画虎,这次来一篇Apple iBooks中《The Swift Programming Language ( Swift 4.2 beta)》中Protocol -- Delegation的译文。 ---- 委托(Delegation)是一种设计模式,能够让类或者结构体将自己一部分责任移交(或者称之为委托delegate)给另一个类型实例。
0x1 Info图片0x2 ReconTarget external IP39.98.34.149Nmap results图片关注80端口的http服务,目录爆破(省略)找到 /admin 图片使用弱口令登录进入后台,去到模板页面,编辑header.html,添加php一句话`用户名: admin, 密码:123456与委托(Delegation)[实例程序源代码从这里下载] 目录: 一、从访问令牌(Access Token)说起 ,但无法在远程系统上模拟客户端; 委托(Delegation):可以在本地和远程系统上模拟客户端的安全上下文。 { 3: None, 4: Anonymous, 5: Identification, 6: Impersonation, 7: Delegation 但是,只有当模拟级别为Imperation或者Delegation的情况下,采用真正使用被模拟的身份进行安全资源的访问。 { impersonationLevel = 2; break; } 26: case TokenImpersonationLevel.Delegation
值得注意的是Hadoop生态中有许多其它的服务也是用到了Delegation Tokens,为了简单起见,这里只讨论Delegation Tokens在HDFS和KMS中的应用。 Delegation Tokens的认证过程如下: client通过Kerberos与Server完成认证,并从server获取相应的Delegation Tokens。 另一方面,每个Delegation Token与其关联服务严格的绑定在一起,且最终会过期。所以,即使Delegation Token泄露,也不会造成太大损失。 下面是提交job时的日志的一段摘录,在下面的日志中,我们看到了HDFS Delegation Token和KMS Delegation Token。 需要解密HDFS加密区的文件时,使用KMS Delegation Token。 job结束后,RM则取消该job的Delegation Tokens。
首先介绍一下JavaScript的事件代理。事件代理在JS世界中一个非常有用也很有趣的功能。当我们需要对很多元素添加事件的时候,可以通过将事件添加到它们的父节点而将事件委托给父节点来触发处理函数。这主要得益于浏览器的事件冒泡机制。
最后发现是和delegation token有关,本文就来总结下相关的原理。 【原理】 ---- 1. 什么是delegation token 先简单描述下为什么需要delegation token。 2. delegation token在任务提交运行过程中的使用 任务提交运行过程中,delegation token相关的流程如下图所示: 1)首先,RM启动后,内部会创建一个服务线程专门用于处理 在该服务中,会启动线程定时对delegation token进行更新。此后,继续向NM发送启动container的请求,delegation token则随启动上下文被带到NM中。 token NM收到启动container的请求后,从请求(任务启动上下文)中解析出delegation token,并为该container构造一个对应的实例对象,同时将delegation token 50 RM中delegation token更新线程的线程数 【总结】 ---- 本文通过一个实际的问题,并结合源码讲解了hadoop的delegation token的相关原理。
生成/验证 delegation token密码 | | 2. | +---------------------------------------------------------------------+ 1.2 密码生成机制 Delegation 获取 delegation token Token<RMDelegationTokenIdentifier> token = rm.getDelegationToken(ugi); // 2. 1天 密钥更新间隔 yarn.resourcemanager.delegation.token.max-lifetime 7天 令牌最大生命周期 yarn.resourcemanager.delegation.token.renew-interval 24小时 令牌续期间隔 yarn.resourcemanager.delegation.token.remover-scan-interval 1小时 过期令牌扫描间隔 五、安全特性总结 密钥轮换:
当 OM 收到来自客户端的带有delegation token的请求时,它会通过使用其公钥检查签名来验证令牌。delegation token可以转移到其他客户端进程。 当令牌过期时,原始客户端必须请求新的delegation token,然后将其传递给其他客户端进程。 delegation token操作:例如获取、更新和取消,只能通过 Kerberos 身份认证的连接执行。 1.3 Block token Block token和delegation token类似,它们都是由OM发行/签名的。 对于delegation token,当 OM(既是令牌颁发者又是令牌验证者)在高可用性 (HA) 模式下运行时,有多个 OM 实例同时运行。
write-only" /> <transition to="evaluating"> <action event="transition" handler="org.jbpm.workflow.<em>delegation</em>.impl.action.MsgQueueAction comment ${comment}</parameter> </action> <action event="transition" handler="org.jbpm.workflow.<em>delegation</em>.impl.action.EmailAction </description> <assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver </description> <assignment handler="org.jbpm.workflow.<em>delegation</em>.impl.assignment.AssignmentExpressionResolver </description> <assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver
defined, it is provided to the driver, and the driver will manage the kerberos login and the creation of delegation tokens. existing tokens: if a secret containing delegation tokens is provided, it will be mounted on tokens to executors. tgt only: if Hadoop security is enabled, the local TGT will be used to create delegation 相关的配置通过 configmap 来保存,所以后面 driver 和 exectutor 启动,就可以直接通过 configmap 读到 hadoop 相关配置,以及拿到与 datanode 交互的 delegation
本文主要记录Spark概念架构、SparkStreaming性能问题处理、SparkStreaming 7*24作业在Kerberos Hadoop集群HDFS_DELEGATION_TOKEN问题处理 问题 我们知道SparkStreaming作业属于7*24长时间运行的流作业,客户反馈说任务每7天就报错退出,异常日志提示:HDFS_DELEGATION_TOKEN is expired。 这里先简单说明下原理就是开启Kerberos认证的Hadoop集群中HDFS的namenode会生成HDFS_DELEGATION_TOKEN,同时给token设置相关生命周期管理参数。 SparkStreaming通过HadoopDelegationTokenManager类实现周期性地登录KDC、周期性地申请delegation token。 也就是在delegation token过期前,Driver会重新申请新token,然后通过IPC发送给Execuors,从而确保SparkStreaming能够长时间运行。
input for Map #4 Starting Job 17/12/26 06:42:09 INFO hdfs.DFSClient: Created token for fayson: HDFS_DELEGATION_TOKEN nameservice1 17/12/26 06:42:09 INFO security.TokenCache: Got dt for hdfs://nameservice1; Kind: HDFS_DELEGATION_TOKEN , Service: ha-hdfs:nameservice1, Ident: (token for fayson: HDFS_DELEGATION_TOKEN owner=fayson@CLOUDERA.COM Submitting tokens for job: job_1514262166956_0009 17/12/26 06:42:10 INFO mapreduce.JobSubmitter: Kind: HDFS_DELEGATION_TOKEN , Service: ha-hdfs:nameservice1, Ident: (token for fayson: HDFS_DELEGATION_TOKEN owner=fayson@CLOUDERA.COM
pragma solidity ^0.4.22; /// @title Voting with delegation.一个有委托功能的投票系统 contract Ballot { // This represent a single voter.代表一个投票人 struct Voter { uint weight; // weight is accumulated by delegation = msg.sender, "Self-delegation is disallowed."); // Forward the delegation as long as = address(0)) { to = voters[to].delegate; // We found a loop in the delegation = msg.sender, "Found loop in delegation."); } // Since `sender` is a reference, this
pragma solidity ^0.4.22; /// @title Voting with delegation.一个有委托功能的投票系统 contract Ballot { // This represent a single voter.代表一个投票人 struct Voter { uint weight; // weight is accumulated by delegation = msg.sender, "Self-delegation is disallowed."); // Forward the delegation as long as = address(0)) { to = voters[to].delegate; // We found a loop in the delegation = msg.sender, "Found loop in delegation."); } // Since `sender` is a reference, this
, and all users that aren't marked as sensitive/not for delegation $Computers = Get-NetComputer -Unconstrained , logged into servers that allow unconstrained delegation Invoke-UserHunter -Unconstrained -AdminCount , and all privileged users that aren't marked as sensitive/not for delegation $Computers = Get-DomainComputer , logged into servers that allow unconstrained delegation Find-DomainUserLocation -ComputerUnconstrained 用打印服务获取域控 Computer Takeover Combining NTLM Relaying and Kerberos delegation CVE-2019-1040 (8)地址解析协议
) apply:59, StreamPlanner$$anonfun$translateToPlan$1 (org.apache.Flink.table.planner.delegation) apply 即:把 SQL 转换成为 AST (抽象语法树),在 Calcite 中用 SqlNode 来表示; package org.apache.Flink.table.planner.delegation ) <init>:86, PlannerBase (org.apache.Flink.table.planner.delegation) <init>:44, StreamPlanner (org.apache.Flink.table.planner.delegation ) apply:59, StreamPlanner$$anonfun$translateToPlan$1 (org.apache.Flink.table.planner.delegation) apply ) apply:59, StreamPlanner$$anonfun$translateToPlan$1 (org.apache.flink.table.planner.delegation) apply
QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT) final DelegationParam delegation , //... ) throws IOException, InterruptedException { init(ugi, delegation, username, Override public Response run() throws IOException, URISyntaxException { return get(ugi, delegation (NameNode)context.getAttribute("name.node"); final URI uri = redirectURI(null, namenode, ugi, delegation