<?php
// Assume $_GET['user_input'] is some input from the user
echo $_GET['user_input'];
?>
<%@ page import="java.util.*" %>
<html>
<body>
<%= request.getParameter("user_input") %>
</body>
</html>
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {
Response.Write(Request.QueryString["user_input"]);
}
</script>
<html>
<body>
</body>
</html>
const express = require('express');
const app = express();app.set('view engine', 'ejs');
app.get('/', (req, res) => {
res.render('index', { user_input: req.query.user_input });
});
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
<html>
<body>
<%- user_input %>
</body>
</html>
2. IDOR
<?php
// Assuming a request to get a user's profile information
$user_id = $_GET['user_id'];
$query = "SELECT * FROM users WHERE id = '$user_id'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
echo "User Profile: " . $row['profile'];
?>
@RestController
@RequestMapping("/users")
public class UserController {
@Autowired
private UserRepository userRepository; @GetMapping("/{id}")
public User getUser(@PathVariable Long id) {
return userRepository.findById(id).orElse(null);
}
}
[HttpGet("{id}")]
public async Task<IActionResult> GetUser(int id)
{
var user = await _context.Users.FindAsync(id);
if (user == null)
{
return NotFound();
}
return Ok(user);
}
const express = require('express');
const app = express();
const users = require('./userModel');app.get('/users/:id', (req, res) => {
const userId = req.params.id;
users.findById(userId, (err, user) => {
if (err) {
return res.status(500).send(err);
}
res.json(user);
});
});
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
3. RCE
eval()
or system()
functions with user-controlled input.2. RCE in Java:
3. RCE in .NET:
System.Reflection
or deserialization vulnerabilities with user-controlled input.4. RCE in Node.js:
eval()
function or executing shell commands with user-controlled input using child_process.exec()
.