GPEN · Question #400
You are pen testing a Linux target from your windows-based attack platform. You just moved a script file from the windows system to the Linux target, but it will not execute properly. What is the…
The correct answer is A. The byte length is different on the two machines. When transferring a script from Windows to Linux, the differing line-ending conventions (CRLF vs LF) change the byte length of the file, causing the script interpreter to misparse and fail to execute commands.
Question
You are pen testing a Linux target from your windows-based attack platform. You just moved a script file from the windows system to the Linux target, but it will not execute properly. What is the most likely problem?
Options
- AThe byte length is different on the two machines
- BEnd of-line characters are different on the two machines
- CThe file must have become corrupt during transfer
- DASCII character sets are different on the two machines
How the community answered
(19 responses)- A68% (13)
- B11% (2)
- C5% (1)
- D16% (3)
Why each option
When transferring a script from Windows to Linux, the differing line-ending conventions (CRLF vs LF) change the byte length of the file, causing the script interpreter to misparse and fail to execute commands.
Windows text files use CRLF (carriage return + line feed, 2 bytes per line ending) while Linux uses only LF (1 byte per line ending), so the same script has a measurably different byte length on each platform. The extra carriage return characters (\r) that remain in the Linux-transferred file are interpreted as part of command strings by the shell interpreter, causing execution errors and broken command parsing.
End-of-line character differences are the underlying cause, but this choice describes a symptom rather than the directly observable measurement - the byte length discrepancy - that confirms the file was not properly converted.
File corruption during transfer is extremely unlikely with modern protocols such as SCP or SFTP and is a far less probable explanation than a predictable, systematic platform encoding difference.
Both Windows and Linux use compatible ASCII character sets as their base encoding; ASCII character set incompatibility is not a reason a shell script fails after cross-platform transfer.
Concept tested: Cross-platform text file byte length and line endings
Source: https://learn.microsoft.com/en-us/windows/wsl/tutorials/linux-tools
Topics
Community Discussion
No community discussion yet for this question.